Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
problems when moving code from Macro to Command button on sheet
You could have the CommandButton call the macro that works.
The problem is likely this line: Set myC = Range("I6:I233").Find(What:="", LookAt:=xlWhole) Excel takes the range to be on whatever the active sheet is. If you change it to: Set myC = Worksheets.("Printout").Range("I6:I233").Find(What :="", LookAt:=xlWhole) the range is better specified. HTH, Merjet |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
problems when moving code from Macro to Command button on shee
I didn't get a runtime error on the modified line:
Set myC = Worksheets("Printout").Range("I6:I233").Find(What: ="", LookAt:=xlWhole) However, I did on this one: Range(myC, Range("I233")).Resize(, 5).Delete Shift:=xlUp until I also modified it to: Worksheets("Printout").Range(myC, Worksheets("Printout").Range("I233")).Resize(, 5).Delete Shift:=xlUp HTH, Merjet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
moved vba code from macro to command button, now won't work | Excel Programming | |||
Code created in a Macro not working for a Command Button | Excel Programming | |||
Excel - keep a command button from moving after code runs? | Excel Programming | |||
macro code doesnt work in command button | Excel Programming | |||
generating sheet with command button & code | Excel Programming |