MACRO to add data based on questions

ghp2017

Board Regular
Joined
Dec 12, 2017
Messages
51
Hello,
I am trying to create a Macro that will insert the answers to two questions. The trick is that I need the the first question to go into the next empty cell in Column B and the second answer to go in the cell right next to it in Column C.

I have the first part down but I can't figure out the second. So far I have this:

strName = InputBox("What PartID would you like to add?")
strName1 = InputBox("How many would you like to add?")
NextEmptyRow = Sheets("Template").Cells(Rows.Count, "B").End(xlUp).Offset(1).Row
Sheets("Template").Cells(NextEmptyRow, "B").Value = strName
Range("C").Select
ActiveCell.FormulaR1C1 = strName1

End Sub

I have also tried breaking these two down into 2 different Subs and then creating a MASTER.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You almost had it!
Code:
[B]strName = InputBox("What PartID would you like to add?")
[B]strName1 = InputBox("How many would you like to add?")
[B]NextEmptyRow = Sheets("Template").Cells(Rows.Count, "B").End(xlUp).Offset(1).Row
[B]Sheets("Template").Cells(NextEmptyRow, "B").Value = strName
[/B][/B][/B][/B][B][B][B][B]Sheets("Template").Cells(NextEmptyRow, "C").Value = strName1[/B][/B][/B][/B]

 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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