View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Flintstone[_4_] Flintstone[_4_] is offline
external usenet poster
 
Posts: 1
Default 20 Procedures one Command button


Newbie question:

Is it possible to have a command button execute a different procedure
based on the Shape in which the Text Box was called to show from. In
other words I have 20 shapes and I want to use a single Text Box and
then have the Command button execute a different code based on the
Rectangle number.

Sub Rectangle1_Click()
txtBoxForm.Show
End Sub


The only thing I need to change is the row number on ws2, if Rectangle2
is used the row number would be 5.


Private Sub cmdSave_Click()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Worksheets("Names List")
Set ws2 = Worksheets("BDS Under Construction")

'check for a comment
If Trim(Me.BdayText.Value) = "" Then
Me.BdayText.SetFocus
MsgBox "OOPS! Try again."
Exit Sub
End If

'copy text to the appropriate cell.
ws1.Cells((ws2.Cells(4, 80)) - 3, 3) = Me.BdayText.Value
End Sub


I’m probably going about this all wrong, so any thoughts are greatly
appreciated.


Matt


--
Flintstone
------------------------------------------------------------------------
Flintstone's Profile: http://www.excelforum.com/member.php...o&userid=15310
View this thread: http://www.excelforum.com/showthread...hreadid=552001