If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Edit Recorded Macro to Apply to Multiple Sheets

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-07, 17:24
GHK GHK is offline
Registered User
 
Join Date: Sep 2007
Posts: 11
Edit Recorded Macro to Apply to Multiple Sheets

Hi - I'm a novice at using EXCEL Macros. I'm trying to create a macro whereby I copy ovetime hours, overtime pay, and the organization code within each worksheet to a new worksheet (on a new line) so that I can capture all overtime hours and pay for each organzation in one sheet. All of the data are located in the same cells within each worksheet. I created a recorded macro to copy the data from one sheet into a new sheet. However, I now need to edit the macro (in Visual Basic) so that the process repeats itself for each sheet in the workbook. I think I need a "Do ... While ... Loop" to carryout the macro for all sheets in the workbook until there are no more sheets. I'm trying to develop this macro so that I can repeat this process every pay period. Any help that anyone out there can provide would be much appreciated. Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 09-19-07, 23:29
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Howdy and welcome to the board. If you are a newbie to VBA, then I would suggest using looping with "For Each Worksheet" in workbook rather than Do ... While loop. Also, do you have a naming scheme for the worksheets?

Also, if you want to add at the bottom of the new worksheet, then you will need to determine the next blank row. Something along this line

Code:
Dim NextRow as Long
NextRow = Worsheets("NewSheet").Cells(Rows.Count,1).End(Xlup).Row + 1
Then you can use NextRow to determine where to paste.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 09-21-07, 15:52
GHK GHK is offline
Registered User
 
Join Date: Sep 2007
Posts: 11
Rich - Thanks for the response. Will try what you suggested.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On