Thread: Command Button
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Command Button

Two guesses.

#1. You're using xl97. Try changing the .takefocusonclick to False.
Or add: Activecell.activate (right near the top of your code)

#2. You didn't qualify your ranges.
If it's an unqualified range in a worksheet module, then it refers to the
sheet that owns the code:

behind sheet1:
worksheets("sheet2").select
range("a1").value = 99

that range("a1") refers to sheet1--not the activesheet.



"jongdg <" wrote:

This is probably a simple problem. There are certain macro's that I
want to assign a command button to. I have no problem if the macro
functions within the sheet that contains the button. But, if the macro
calls for information contained within a different sheet, the macro
fails. The strange part is that these macro run fine if there not
assigned to a command button. But once the same macro code is copied
into the private sub of a command button, it fails.

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson