Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have been working on this vb code for a while now. The scenario is
that I am taking 1million+ records, filtering them through Access, then exporting them to Excel. Once they are in excel I am appling formulas and formats to specific columns. The sheets are spit out one salesman at a time, formatted, closed, then the next one is spit out, formatted and closed, and so on. The very first sheet that comes out works great. However, it will not continue. I end up with a Runtime Error 91 "Object variable or With block variable not set". When I press debug "xl.Range(Selection, Selection.End(xlUp).Offset(1, 0)).Select" is highlighted. 'Column GM% xl.Range("A65536").End(xlUp).Offset(0, 11).Select xl.Range(Selection, Selection.End(xlUp).Offset(1, 0)).Select With xl.Selection.Interior .Pattern = xlSolid .ColorIndex = 33 End With xl.Selection.NumberFormat = "0.0%" xl.Range("A1").Select If I take out that one line, everything is fine, except that I do not get that column filled in with the color, but it does continue to the next set of formats, stopping at the same spot in this section: xl.Range("A65536").End(xlUp).Offset(0, 13).Select xl.Range(Selection, Selection.End(xlUp).Offset(1, 0)).Select With xl.Selection.Interior .ColorIndex = 36 .Pattern = xlSolid End With xl.Selection.NumberFormat = "0.0%" xl.Range("A1").Select Does anyone have any ideas of what I am doing wrong here? Thank you in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error code 1004 | Excel Worksheet Functions | |||
VBA Code runtime error only after opening Locals window | Excel Programming | |||
After sharing workbook VB code stops working. Runtime Error 1004 | Excel Programming | |||
RunTime Error 424 in a USERFORM's code | Excel Programming | |||
Repost with code - Runtime error '1004' | Excel Programming |