PDA

View Full Version : Loop to create number thru all sheet



slamet Harto
02-09-2009, 10:14 PM
Hi there,

hope you are doing good.

Can you help to fix my vba code that adapt from jmt-forum
1. I want to create a loop to create number on particular sheets except for sheet mainsheet and template.

2. How to create agents sheet by ignoring sheet template

Thanks in advance

Bob Phillips
02-10-2009, 02:15 AM
More detail required as it seems to be doing what you ask already. What is wrong in that code?

Simon Lloyd
02-10-2009, 02:17 AM
Hi there,

hope you are doing good.

Can you help to fix my vba code that adapt from jmt-forum
1. I want to create a loop to create number on particular sheets except for sheet mainsheet and templateWhat number? where on the sheets?

Simon Lloyd
02-10-2009, 02:18 AM
Sorry Bob i seem to be on your toes this morning! :)

slamet Harto
02-10-2009, 03:49 AM
Appologise me

Q1: after the code run, The number is in column A starting row 5 for all sheet except for MainSheet and Template. So, we start with No:1 then 2 up to the end of row for each sheet.

Q2: The following code is to copy sheet template but I want to ignore this copy sheet and use copy range in sheet "mainsheet"
is it possible to Copy range A4:G4 in mainsheet to all sheet
'Add sheets
For Each a In Ag

Sheets("Template").Copy After:=Sheets(Sheets.Count)

ActiveSheet.Name = a

Next


Thank you for kind assistance
Rgds, Harto

Simon Lloyd
02-10-2009, 03:59 AM
Why use code for an incrementing number? you could simply use a formula in each sheet i.e =Sheet1!A1+1 and so on in your sheets, also if you simply want to copy the data to every sheet from A4:G4 on main sheet to A4:G4 on every other sheet then simply group all sheets select first sheet goto last sheet hold down shift and click last tab) then copy A4:G4 and paste in the same place....you really dont need code unless this is an action that you are going to repeat daily or more frequent!