Input Box For Macro

Parra

Well-known Member
Joined
Feb 21, 2002
Messages
752
I have the macro below that looks at the sheet name in column A and copies what is in Column B to the sheet that is column A.

Ex
Col A Col B
Sheet1 5000

So in Sheet 1 it adds 5000

The problem is I want the target cell I want the data to go to changes. This means when I want it to go somewhere else I have to go into the macro and change the target cell.

Can someone please help me create an input box where the box would appear and I would just enter the the column and row and the macro would then run.

Here is the target cell for this week
.Cells(21, 15)

Thanks

Sub Macro1()


myRow = 1

Do Until Cells(myRow, 1) = ""
myName = Cells(myRow, 1)
Sheets("" & myName).Cells(21, 15) = Cells(myRow, 2)
myRow = myRow + 1
Loop

'
End Sub

Thanks
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
How come I get a runtime error message 13, type mismatch?


Sub Macrotest()

myRow = 1

Do Until Cells(myRow, 1) = ""
myName = Cells(myRow, 1)
targetcell = InputBox("enter target cell here")
Sheets("" & myName).Cells(targetcell) = Cells(myRow, 2)
myRow = myRow + 1
Loop

'
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,449
Members
448,966
Latest member
DannyC96

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