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: 1
Default Command Button Code Stream lining


Ok, I have this barbaric code for a set of 34 separate command buttons
that I am using to archive a set of data here's the code (for 1 of the
34 they all are the same code):

Private Sub CommandButton1_Click()
blah = 3
Bla = "3"
newrow
Set SourceRange = Sheets("Current Patients").Range(Cells(blah, 1),
Cells(blah, 14))
Set destrange = Sheets("Archive").Range("A3")
SourceRange.Copy destrange
Set fixrow = Sheets("Archive").Rows("3:3")
fixrow.RowHeight = 12.75
Set SourceRange = Sheets("Current Patients").Range(Cells(blah + 1,
1), Cells(34, 14))
Set destrange = Sheets("Current Patients").Range("A" + Bla)
SourceRange.Copy destrange
Cells(blah, 1).Select
End Sub

Sub newrow()

Application.CutCopyMode = False
Sheets("Archive").Rows("3:3").Insert Shift:=xlDown
Sheets("Archive").Cells(3, 15).Value = Now

End Sub

Is there a way where I can just dig up the the name so that I can use
the # in the name e.g. It is # of command button +2 I want to use.
There has to be some easy way to do this without the 34 separate
reiterations of code. Another minor question is if I can some how auto
fit the command button sizes to the size of a cell w/o manually doing
it.

Thank you,
Jeremy Donaghue


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

 
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
command button code dummy Excel Discussion (Misc queries) 2 December 1st 09 02:57 PM
VBA code behind command button [email protected] Excel Worksheet Functions 1 March 22nd 06 08:13 PM
Command Button VBA code Dave Peterson Excel Discussion (Misc queries) 2 January 25th 05 11:28 PM
generating sheet with command button & code Bob[_27_] Excel Programming 4 August 4th 03 02:46 PM
Create Command Button from Code Bruce B[_2_] Excel Programming 0 July 14th 03 02:01 PM


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

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

About Us

"It's about Microsoft Excel"