How do you place an x into a cell by clicking a button?
placing an x from a button into a cell
Collapse
X
-
It depends, if the command button is in a Form, just put it in the code:
[CODE=vb]private sub commandbutton1_ click()
dim row as long
dim col as integer
row = 1
col = 1
cells(row,col). value = "x" 'this will write an x in cell A1
end sub[/CODE]
If you are adding a button to your excel sheet, just write down a sub in a module, something like:
[CODE=vb]sub anything()
dim row as long
dim col as integer
row = 1
col = 1
cells(row,col). value = "x" 'this will write an x in cell A1
end sub[/CODE]
hope this helps
Kad -
to the same question is there a way to have it take the x out of anouther cell if you have it in anouther cell. for example i have a done and not done colums. II'm lookin to put an x in the not done cell and when it is done then i would like it to put an x in the done and get ride of the not done one. Thanks for all the help.Comment
-
Originally posted by golf32902to the same question is there a way to have it take the x out of anouther cell if you have it in anouther cell. for example i have a done and not done colums. II'm lookin to put an x in the not done cell and when it is done then i would like it to put an x in the done and get ride of the not done one. Thanks for all the help.
[CODE=vb]sub anything()
dim row as long
dim col as integer
row = 1
col = 1
cells(row,col). value = "x" 'this will write an x in cell A1
end sub[/CODE]
where it says Row and Col, just change the number, if you want the cell B5 just put
Row = 5
Col = 2
and if you want to clear the cell, instead of filling it with "x", just fill it with ""
;-) Good LuckComment
Comment