Every time the button is pressed output the values row below.

rebeila

New Member
Joined
Oct 6, 2023
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hello!

I have a VBA code that consists of some msgboxes and input boxes. Basically when you press the button and the macro runs the values are inserted on different worksheets. Instead of having many buttons, I want one button that will have the same code but insert one row below.

Any Ideas_
 
What do you mean it does not work?
Do you get a message box pop-up?
I want you to tell me exactly what it returns each time when you run the code twice.

If you are not getting any Message Box at all, then you probably aren't running the right code!
You should be getting either a Message Box or an error. If you get an error, please tell me what it says, and hit the "Debug" button and tell me which line of code it highlights.
The code MsgBox Next row just pops us the msg box saying 5 that is it and then it proceeds to show me other msg boxes.
the first time i run it in inserts in row 5, and the second time in the same row. That being said it acknowledges only the second (most recent input)
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Ah, I see the issue! Minor update needed.

Change this line:
VBA Code:
nextRow = Cells(ws.Rows.Count, "C").End(xlUp).Row + 1
to this:
VBA Code:
nextRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row + 1
 
Upvote 0
Ah, I see the issue! Minor update needed.

Change this line:
VBA Code:
nextRow = Cells(ws.Rows.Count, "C").End(xlUp).Row + 1
to this:
VBA Code:
nextRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row + 1
Yesss!!! Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,079
Messages
6,122,998
Members
449,092
Latest member
masterms

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