View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
gtslabs gtslabs is offline
external usenet poster
 
Posts: 54
Default Calling sub from CommandButton knowing which sheet is active

I have many sheets with a command button on it using the same code.
I want to change this so I have one code.

I put that code in a module and made it PUBLIC

Public Sub Process()
' do stuff
client = Me.Range("C4")
' do stuf
end sub


my Command button on each sheet now had this code:
Private Sub CommandButton2_Click()
Call process
end sub


The problem I have is at the "ME" statement gives me an error -
"Invalid use of ME keyword"
The subroutine takes inforrmation from the sheet with the command
button and puts it on a different sheet. How do I code so the sheet
the code is called from is the active sheet or it knows its the active
sheet?