View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
external usenet poster
 
Posts: 812
Default 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