Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Help With A Loop To Copy
I'm just getting started learning Excel VBA and I would
very much appreciate some help with a loop structure that I've been struggling to write. Each month, data is imported into an Excel spreadsheet. Because the number of rows will vary every month, I thought a loop structure would be a good way to handle the following procedu In my spreadsheet template there are 5 columns: Column A - Contains text Column B - Contains Date/Time Entries Columns/Rows C1 & D1 - Contain Formulas for Date calculations The steps I'm trying to work through a 1) Start in cell A3 2) Determine if cell is empty 3) If it is not empty, move to range (C1:D1) containing forumulas 4) Copy range (C1:D1) 5) Move down to C3:D3 6) Paste formulas 7) Move to A4 and repeat 8) Stop when an empty cell in Column A is encountered I've tried several times, but have come up empty. Any help would be much appreciated. Thanks in advance, Val |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Help With A Loop To Copy
Sub Tester1()
Dim rng As Range Set rng = Range(Cells(3, 1), Cells(Rows.Count, 1).End(xlUp)) rng.Offset(0, 2).Resize(, 2).Formula = Range("C1:D1").Formula End Sub worked for me. -- Regards, Tom Ogilvy "vsingler" wrote in message ... I'm just getting started learning Excel VBA and I would very much appreciate some help with a loop structure that I've been struggling to write. Each month, data is imported into an Excel spreadsheet. Because the number of rows will vary every month, I thought a loop structure would be a good way to handle the following procedu In my spreadsheet template there are 5 columns: Column A - Contains text Column B - Contains Date/Time Entries Columns/Rows C1 & D1 - Contain Formulas for Date calculations The steps I'm trying to work through a 1) Start in cell A3 2) Determine if cell is empty 3) If it is not empty, move to range (C1:D1) containing forumulas 4) Copy range (C1:D1) 5) Move down to C3:D3 6) Paste formulas 7) Move to A4 and repeat 8) Stop when an empty cell in Column A is encountered I've tried several times, but have come up empty. Any help would be much appreciated. Thanks in advance, Val |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Help With A Loop To Copy
Tom --
Thanks so much for your help. It works like the proverbial charm! Val -----Original Message----- Sub Tester1() Dim rng As Range Set rng = Range(Cells(3, 1), Cells(Rows.Count, 1).End (xlUp)) rng.Offset(0, 2).Resize(, 2).Formula = Range ("C1:D1").Formula End Sub worked for me. -- Regards, Tom Ogilvy "vsingler" wrote in message ... I'm just getting started learning Excel VBA and I would very much appreciate some help with a loop structure that I've been struggling to write. Each month, data is imported into an Excel spreadsheet. Because the number of rows will vary every month, I thought a loop structure would be a good way to handle the following procedu In my spreadsheet template there are 5 columns: Column A - Contains text Column B - Contains Date/Time Entries Columns/Rows C1 & D1 - Contain Formulas for Date calculations The steps I'm trying to work through a 1) Start in cell A3 2) Determine if cell is empty 3) If it is not empty, move to range (C1:D1) containing forumulas 4) Copy range (C1:D1) 5) Move down to C3:D3 6) Paste formulas 7) Move to A4 and repeat 8) Stop when an empty cell in Column A is encountered I've tried several times, but have come up empty. Any help would be much appreciated. Thanks in advance, Val . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
compare cells, copy, loop | Excel Worksheet Functions | |||
VBA Loop to Find then Copy & Paste | Excel Discussion (Misc queries) | |||
Find and Copy loop problem | Excel Discussion (Misc queries) | |||
copy and paste loop | Excel Programming | |||
search & copy with loop | Excel Programming |