Phelony
07-15-2009, 03:05 AM
Hi guys
Yet again, I've managed to break something really simple and don't quite understand why. :mkay
The below is supposed to open an input box, get a number, stash the number in cell M1, exit the sub if you click cancel and then copy 50 rows and 13 columns beneath the same depending on the input number, less 1 as the information already on screen counts as 1.
It's done it once, then I had to add the vbcancel part and it's stopped working.....:banghead:
Could I please borrow someones superior knowledge of such things to tell me how I've killed it?
Sub Moreaccounts()
'
' Moreaccounts Macro
Sheets("NCA A Page 2").Select
Answer = InputBox("How many accounts do you require in total?")
Range("M1") = Answer
If vbCancel Then Exit Sub
Dim t As Long
For t = 1 To Range("M1").Value - 1
With Range("A1")
.Resize(51, 13).Copy .Offset(t * 50 + 0, 0)
End With
Next t
End Sub
I'm sure there's nothing overtly complicated here, but I've been messing with it for a while now and it's just annoying. :motz2:
:help
Phel x
Yet again, I've managed to break something really simple and don't quite understand why. :mkay
The below is supposed to open an input box, get a number, stash the number in cell M1, exit the sub if you click cancel and then copy 50 rows and 13 columns beneath the same depending on the input number, less 1 as the information already on screen counts as 1.
It's done it once, then I had to add the vbcancel part and it's stopped working.....:banghead:
Could I please borrow someones superior knowledge of such things to tell me how I've killed it?
Sub Moreaccounts()
'
' Moreaccounts Macro
Sheets("NCA A Page 2").Select
Answer = InputBox("How many accounts do you require in total?")
Range("M1") = Answer
If vbCancel Then Exit Sub
Dim t As Long
For t = 1 To Range("M1").Value - 1
With Range("A1")
.Resize(51, 13).Copy .Offset(t * 50 + 0, 0)
End With
Next t
End Sub
I'm sure there's nothing overtly complicated here, but I've been messing with it for a while now and it's just annoying. :motz2:
:help
Phel x