LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Using a single cmdButton to perform different tasks

[Excel 2003]

I have a user form with text boxes.

I populate the text boxes using the following type of code:

Private Sub CommandSheet1Get_Click()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
Me.txtname.Value = ws.Range("A1").Value
End Sub

I can edit the text boxes and then update the spreadsheet with the following
code in another command button

Private Sub cmdSendtoSheet1_Click()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")
ws.Range("A1").Value = Me.txtname.Value
End Sub

Using this approach I can use a number of command buttons to pull data to
the text boxes from different sheets 1,2,3....10. However, here is my
question/problem.

Although I want to have separate buttons for pulling the data to the
textboxes, I want to use just a single button for sending the edited data
back to the sheets.

So what I would need is for the code to keep track of which sheet the data
came from and when the button is pressed, would access the suitable
subroutine to return the data to the right sheet

To put things in perspective I have approx 300 cells on each sheet to deal
with. The same cells on each sheet are used for storing the data I work with.

Can anyone help?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I perform multiple formating within a single line of text? TroyG Excel Worksheet Functions 2 October 13th 06 04:27 AM
CmdButton on worksheet1 missing pdavis Excel Discussion (Misc queries) 0 August 2nd 06 08:01 PM
Add to CmdButton oberon.black[_43_] Excel Programming 0 September 11th 05 11:45 PM
Automation of Excel to perform simple tasks on many workbooks. admin4office Excel Programming 4 February 15th 05 12:49 AM
Can I perform tasks on a closed Workbook Jeff Excel Programming 1 January 27th 05 06:13 PM


All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"