Adding one to cell value
Thanks!!
"Corey" wrote:
Sorry, might be my fault with the 2 x fullstops in the SELECT line.
There is ONLY one.
"Corey" wrote in message ...
1. Make sure the Button name is correct, i used Button1, but this need not be the case if you
have more than 1 already
2. If you right click the button and select Asign Macro the code between the grey lines should have:
Sub Button1_Click()
With Sheet1
..Select
If ActiveCell.Value < "" Then
ActiveCell.Value = ActiveCell.Value + 1
End If
End With
End Sub
3. Make sure there is only ONE fullstop in the line .Select
ctm
"Excel Noob" wrote in message
...
It keeps saying the ..Select thing is a syntax error. It's highlighted in
blue and the Sub Button1_Click() line is highlighted yellow. It also
sometimes says error: expected:case.
"Corey" wrote:
1. Place a Forms Button on the worksheet
2. It will prompt you to set a macro to it
3. Selecte the NEW option
4. Between the Sub Button1_Click() and the End Sub place the code
With Sheet1
..Select
If activecell.value <"" then
Activecell.value = Activecell.value + 1
end if
end with
Will look like:
Sub Button1_Click()
With Sheet1 ' Does the following with the Sheet selected
..Select ' Selects the Sheet above
If activecell.value <"" then ' Check to see if the Cell that is selected has No Value in it, if
No
Value then doe the following
Activecell.value = Activecell.value + 1 ' Changes the value of the ActiveCell to ADD 1 to the
value
end if ' End of the IF statement (If ActiveCell is empty)
end with ' End of the With Statement (Sheet)
' Ends the SUB Routine
End Sub
Corey....
"Excel Noob" wrote in message
...
I cannot get the macro to work. I can't say I'm really a macro expert. I
tried it using m as the form button, but it wouldn't work. If it's not too
much trouble, could someone explain the process? Microsoft Help didn't
really get it done for me...
"Corey" wrote:
Or you could try:
Sub Button1_Click()
With Sheet1
..Select
If activecell.Value < "" Then
activecell.Value = activecell.Value + 1
End If
End With
End Sub
which will add (1) to the cell that is selected whent he forms button is pressed.
Corey....
"Corey" wrote in message ...
Yes,
Sub Button1_Click()
With Sheet1 ' Changer to suit
..Select
If Range("A1").Value < "" Then ' Change A1 to suit
Range("A1").Value = Range("A1").Value + 1
End If
End With
End Sub
Corey....
"Excel Noob" wrote in message
...
Is there a way, via a macro or some such, that I could add one to the value
of a cell by pushing a button or something, rather than having to manually
change the value?
|