Using Command buttons to enter value in a cell, then move on to the next cell and do the same

mf6605

New Member
Joined
Dec 31, 2020
Messages
1
Office Version
  1. 2010
Platform
  1. Windows
I have some experience creating Input boxes and message boxes and such but I can't seem to figure out how to deal with user forms that have custom command buttons. I'm not the greatest at explaining my thought process and I'm still kind of a noob at this so bear with me lol.

Basically I created a user form with three command buttons. Each command button enters a specific value in the cell. For Example Button1 enters a 1, Button 2 enters a 2 and Button 3 enters a 3. I figured out how to do that however, it doesn't work with the big picture I have in mind as this is only attached to one specific cell.

The big picture is the following...

For Example, what I want is for the form I created to pop up (Which I was able to do) then when I select "Button2" it enters the value "2" into cell "A1". Then right after I want the exact same form to pop up but this time I want the value of what ever button I select to be entered into cell "A3". Then keep it going for Cell A4,A5,A6, and so on.

How should I code this macro as well as the three command buttons to fit this big picture?

Hopefully you some someone can make sense of this lol

Thank you
 

Some videos you may like

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

EXCEL MAX

Active Member
Joined
Nov 11, 2020
Messages
292
Office Version
  1. 2007
Platform
  1. Windows
Hello mf6605,
you can do that in different ways, depending what you are doing,
but the most common way is counting cells from bottom to the top until meeting first populated cell,
then add one more cell.
Insert this code line before insert value to the cell.
Do it in each command button.
VBA Code:
    With ActiveSheet
        .Range("A" & Cells(Rows.Count, "A").End(xlUp).Row + 1).Activate
    End With
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,122,243
Messages
5,595,027
Members
413,960
Latest member
ikkin

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
Top