rhk001
08-11-2012, 01:36 AM
Hi guys,
I have this code to insert columns into a worksheet. (See below)
This works perfectly when it is in a module on its own (Module1) but
as soon as I add it into the module I have with my other routines (Rob) it returns the error below. I am sure it is something simple, anyone have any ideas ?
Thanks
Rob
---------------------------
Microsoft Visual Basic
---------------------------
Compile error:
Variable not defined
---------------------------
OK Help
---------------------------
Sub cols()
col = Array("b", "c", "d", "e")
For i = UBound(col) To LBound(col) Step -1
Range(col(i) & ":" & col(i)).Insert Shift:=xlToLeft
Next i
End Sub
I have this code to insert columns into a worksheet. (See below)
This works perfectly when it is in a module on its own (Module1) but
as soon as I add it into the module I have with my other routines (Rob) it returns the error below. I am sure it is something simple, anyone have any ideas ?
Thanks
Rob
---------------------------
Microsoft Visual Basic
---------------------------
Compile error:
Variable not defined
---------------------------
OK Help
---------------------------
Sub cols()
col = Array("b", "c", "d", "e")
For i = UBound(col) To LBound(col) Step -1
Range(col(i) & ":" & col(i)).Insert Shift:=xlToLeft
Next i
End Sub