Hi,
I am seeking a help from all excel VBA expert.
I have attached the excel file for reference.
In the "Input" sheet there is production schedule that will be generated on submit button click. And the same schedule will also have to COPIED in "Output" sheet. But I am not able to paste it in desired location (blue highlighted area).
Another challenge for me to retain relevant data corresponding to year and clear the rest.
That means suppose its a schdule for 34 Years, now if I again generate it with 20 years it will keep the values of class I and class II till 20 years only and clear the rest.
The same has to be in Output sheet also.
Some one please help at earliest.
Thanks and regards,
Santosh
The code within Submit_Click: - Sub Submit_Click()
-
Dim no_years As Integer
-
Dim i_val As Integer
-
Range("c10").Activate
-
-
ActiveCell.EntireRow.Clear
-
-
ActiveCell = Range("b3").Value
-
no_years = Range("b4").Value
-
i_val = Range("b5").Value
-
-
-
Do While no_years > 0
-
ActiveCell.Offset(0, 1).Activate
-
ActiveCell.Value = DateAdd("YYYY", i_val, ActiveCell.Offset(0, -1).Value)
-
-
no_years = no_years - 1
-
-
Loop
-
-
' copy production schedule calender to all sheets
-
ActiveCell.EntireRow.Copy Destination:=Sheets("Output").Range("A" & Rows.Count).End(xlUp).Offset(1)
-
-
MsgBox ("Production schedule calendar generated")
-
End Sub
3 3273 zmbd 5,501
Recognized Expert Moderator Expert
skg0009,
+ For various reasons, most of us will not open unrequested attachments.
+ One question per thread.
Line22 is too much.
Say I have a table Range Sheet1!A1:C4 that I want to copy to sheet2 starting in cell Z5... then - Worksheets("sheet1").Range("A1").Select
-
Selection.CurrentRegion.Select
-
Selection.Copy Destination:=Worksheets("Sheet2").Range("Z5")
-
Range("A1").Select
There are a ton of other methods... this is the more straight forward of them and works for a contiguous region of data. You can of course select the data range using various methods.
the above will answer part of your second question too with a bit of thought and novel application.
Thanks a lot.
Can you give me an idea, how do I clear irrelevant data, for ex, after copy and paste new data place in sheet 2 from cell Z5 to AI5, but already few data exist in sheet 2 till AI6.
How do I clear this extra cell data ?
Regards,
zmbd 5,501
Recognized Expert Moderator Expert
new question new thread please
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nathan |
last post by:
A couple of months ago, I went looking for a .NET grid component with
what I thought was pretty simple criteria - I wanted an interface that
provided my users with Excel-like data entry capability. My users
(mostly scientists) use Excel for just about everything and like how
quick and easy it is to manipulte tabular data in Excel. For...
|
by: Kay |
last post by:
Hi all,
I want to copy an entire row from a worksheet to another worksheet, when I
set the excel app = visible and step thru the code I can actally see a row
is appended to another worksheet, but just last a flash, and , anyone know
what's going wrong?
Dim oApp As New Excel.Application
Dim oWBa As Excel.Workbook =...
|
by: keithsimpson3973 |
last post by:
I have the following code to populate an excel spreadsheet from vb6 and access database. It works great except that when it reads from the recordset and populates the spreadsheet, I would like it to populate every other line in the spreadsheet. I can't seem to see anywhere in the code where that might be handled. Any help would be greatly...
|
by: six888 |
last post by:
i need to make a report using excel. im given a few data in excel document for a 1 month report (1 document for each week). each data document have a few work sheet.i need only certain information in each week data. before this i do it manually by copy-paste each information i want to a new excel where i compile all the data for the month.i want...
|
by: OfficeDummy |
last post by:
Hi, everyone!
Like I mentioned in the thread title, I need to copy&paste data between different workbooks, and it works fine. However, when the data has been copied to the destination workbook, the grid disappears.
Why, and how can I get it back?
Thanks a lot in advance!
Best,
OfficeDummy
| |
by: Taxman |
last post by:
Windows XP, MS Office Excel 2003
If the tasks, I’m trying accomplish have been addressed previously (separately or in combination). Please, provide the links or keyword search to find them. I’ve been searching for code for each part of the task separately and trying to piece together multiple macros, that do something similar, to what I’m...
|
by: Gustavo Cesar |
last post by:
Friends,
I need to build a loop on VBA Excel to do the following routine:
1o Action: Select entire row #1 and copy
2o Action: Select entire row #2 and Paste Special -> Formulas
3o Action: Select entire row #1 and Paste Special -> Values
4o Action: Select entire row #2 and copy
5o Action: Select entire row #3 and Paste Special -> Formulas...
|
by: sandy armstrong |
last post by:
Hello everyone
I have a question??? can excel copy data from mulitiple worksheets then paste it into a summary workbook then every time the orginal file is change or anything is added it also refects on the summary workbook
I appreactice the help
|
by: sandy armstrong |
last post by:
Hello and goodMorning,
Can anyone please help me with this. I have a database in excel that has 2 sheets full of data. I would like if i press a button to update then macro searches in Column O if the words " Req. Feed Set Up" then it get move over to sheet 2 in the workbook.
Sub Feed_set_up()
Dim intLastRow As Long
intLastRow =...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |