Force Data Entry into another Cell???

martyloo

Board Regular
Joined
Sep 29, 2010
Messages
100
I have created a number of buttons which when pressed will all display a certain value into a cell.....

After I press a button and it displays the value into a cell, I want to be able to press another button which if there is data already in the cell (from the first button press) it will automatically put the value from the second button pressed into the cell next to it.

The reason I need this is because sometimes i may press the first button twice or the second button first so I will need the values to alternate between two seperate cells.

in other words if data is in one cell automatically put the new data in another cell

can you help????
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
at the moment, when the button is pressed it just displays a value into one cell. Thats as complex as it gets, im new to vba. I want it so if i press the button again or another button that is also assigned to display a value in the same sell - To recognise there is already a value in this cell so go to another cell.....

code so far is as follows:-

Sub Ace1_Click()
With ActiveSheet.Range("c10")
.Value = 11
End With

Which just displays the value 11 into cell c10 when the buttons pressed. If i press that button again I want the value 11 to go into cell c11.

any ideas?
 
Upvote 0
Well below can be modified to:
Code:
Sub Ace1_Click()
If IsEmpty(Range("C10")) Then
  Range("C10") = 11
Else
  Range("C11") = 11
End If
Which will populate C11 if C10 is not empty
 
Upvote 0
so simple, wow thankyou so much.

I have been looking for this information everywhere trawling google and VBA for dummies, join this forum and get the answer in 5 minutes.

Fantastic!
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,411
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top