![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 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 |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Los Angeles, CA
Posts: 752
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|