If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Making a command button work

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-06, 11:01
tair23 tair23 is offline
Registered User
 
Join Date: Jan 2006
Location: Indiana
Posts: 7
Making a command button work

I want a command button that I can click. When it is clicked I want to make column of cells equal to a number in a certial cell if the cell in the column has "X 1D" in it. So lets say I paste a number 180 into cell D6. I have a column of cells D9-D22. When I click the button if a cell in D9-D22 has the value X 1D in it I want it to chenge that X 1D to 180. If the cell is blank leave it blank.

Thank you in advance

Tom

Reply With Quote
  #2 (permalink)  
Old 02-08-06, 00:41
Fazza Fazza is offline
Registered User
 
Join Date: Feb 2006
Posts: 113
Hi Tom,

Create a button - for example via the control toolbox toolbar, and in design mode right click on the button and select "view code".

In VBA enter the following code to execute when the button is pressed

Code:
    Range("D9:D22").Replace What:="X 1D", Replacement:=Range("D6").Value
Exit VBA, exit design mode and press the button.

HTH,
Fazza
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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