Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having a hard time coppying multiple columns with unknown lengths to
different worksheets and then naming the worksheets with the column headers. I keep getting the global error when I try to offset the "startspot" or "startname" to move to the next column. There has to be an easier way or I'm missing something. Any suggestions? My current code is as follows: Dim startspot As Range, startsheet As Integer, personal As Range, startname As Range 'Range("B5").Name = "startspot" startsheet = 1 Set startname = Range("B5") Set startspot = Range("B5") For i = 1 To glcount 'Go to correct workbook and select all entries in given column and copy Windows("New Workbook Formatting").Activate Sheets("Printers").Range("startspot").Select With Worksheets("Printers").Range("startspot") Numpersonal = Range(.Offset(1, 0), .End(xlDown)).Rows.Count End With Set personal = Range("startspot") personal.Offset(1).Resize(Numpersonal, 1).Select Selection.Copy 'Paste to new worksheet in CurrentCGAP and rename worksheet Windows(CurrentCGAP).Activate Sheets.Add Range("A8").Select ActiveSheet.Paste ActiveSheet.Name = startname 'Move to next column and worksheet Range(startspot) = Range(startspot).Offset(0, 1) 'error: Method range of object failed global startsheet = startsheet + 1 Range(startname) = Range(startname).Offset(0, 1) 'error: Method range of object failed global With ActiveSheet .Move After:=Worksheets(Worksheets.Count) End With Next |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
offset not working | Excel Discussion (Misc queries) | |||
Loop with activecell.offset | Excel Programming | |||
Need offset range for loop | Excel Programming | |||
Nested Loop Offset Glitch - Object required (Error 424) | Excel Programming | |||
Offset not working | Excel Programming |