Phelony
04-15-2009, 01:45 AM
Hello again!
I've yet again got stuck in trying to make a macro to do something which I was sure was easy, but seem to have some issues in coding it. :dunno
What I've got, is the cell M1 that calculates the number of required pages of a form, the pages are 49 rows in length and 13 wide.
What's supposed to happen, :bug: is that this code should select the 13 columns and then the number of rows multiplied by the result found in cell M1 and then paste the whole lot into A1, so if M1=5 it multiplies 49 by 5 and copies 245 rows. :whistle: Easy huh? :banghead:
However, I appear to be having some syntax issues with getting it off the ground. I confess that I have actually just hijacked some code from another macro...which is probably where I'm falling down.:doh:
I've looked and looked and looked for a solution and can't seem to work out what should go in here to get the expected result.
So I turn to your greater wisdom in search of :help !
Phel x
'
' Macro2 Macro
'
Sheets("NCA A Page 2").Select
Dim g As Long
For g = Range("M1").Value
'
Range("N1:Z&g*49").Select.Copy
Range("A1").Select.Paste
End Sub
I've yet again got stuck in trying to make a macro to do something which I was sure was easy, but seem to have some issues in coding it. :dunno
What I've got, is the cell M1 that calculates the number of required pages of a form, the pages are 49 rows in length and 13 wide.
What's supposed to happen, :bug: is that this code should select the 13 columns and then the number of rows multiplied by the result found in cell M1 and then paste the whole lot into A1, so if M1=5 it multiplies 49 by 5 and copies 245 rows. :whistle: Easy huh? :banghead:
However, I appear to be having some syntax issues with getting it off the ground. I confess that I have actually just hijacked some code from another macro...which is probably where I'm falling down.:doh:
I've looked and looked and looked for a solution and can't seem to work out what should go in here to get the expected result.
So I turn to your greater wisdom in search of :help !
Phel x
'
' Macro2 Macro
'
Sheets("NCA A Page 2").Select
Dim g As Long
For g = Range("M1").Value
'
Range("N1:Z&g*49").Select.Copy
Range("A1").Select.Paste
End Sub