MrLookout9
New Member
- Joined
- Jun 25, 2011
- Messages
- 27
Long time viewer, first time poster.
I want to build a macro to push a value from an input cell to table on another tab. For the sake of this forum, I made a very simplified version of what I want to do.
On my second tab I have a table with TV shows and number of seasons:
Dexter 6
True Blood 4
Scrubs 9
On my first tab I have a data validation in A2, containing the titles. B2 is an open space where I would like the input to be. Next to that I have an image for which I want to assign the macro (Image of Staples Easy button). So in theory, I would select the show from the drop down list, enter the new number in B2 then click submit to update the table on tab 2.
Here is how I structured the Macro:
Select A2
Copy
Ctrl+F
Paste
Find Next
Close Find
Right Arrow
Copy B2
Ctrl+ Page Down
Ctrl+F
Find Next
Close Find
Right Arrow
Paste
Here is what the code looks like:
Range("A2").Select
Selection.Copy
Cells.Find(What:="True Blood", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Next.Select
Cells.Find(What:="True Blood", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range("B4").Select
ActiveSheet.Paste
Here are my two problems:
1. The find function has hard coded my selection "True Blood" into the code. I believe this should be a string. I have tried entering Range("A2") but that does not work. I also need to consider that on the second find I am on another tab.
2. After finding the show, click the Right arrow should select the cell in column B, instead, again this is hardcoded to "B4".
I appreciate anyones help.
Excel 2010
Windows 7
I want to build a macro to push a value from an input cell to table on another tab. For the sake of this forum, I made a very simplified version of what I want to do.
On my second tab I have a table with TV shows and number of seasons:
Dexter 6
True Blood 4
Scrubs 9
On my first tab I have a data validation in A2, containing the titles. B2 is an open space where I would like the input to be. Next to that I have an image for which I want to assign the macro (Image of Staples Easy button). So in theory, I would select the show from the drop down list, enter the new number in B2 then click submit to update the table on tab 2.
Here is how I structured the Macro:
Select A2
Copy
Ctrl+F
Paste
Find Next
Close Find
Right Arrow
Copy B2
Ctrl+ Page Down
Ctrl+F
Find Next
Close Find
Right Arrow
Paste
Here is what the code looks like:
Range("A2").Select
Selection.Copy
Cells.Find(What:="True Blood", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Next.Select
Cells.Find(What:="True Blood", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range("B4").Select
ActiveSheet.Paste
Here are my two problems:
1. The find function has hard coded my selection "True Blood" into the code. I believe this should be a string. I have tried entering Range("A2") but that does not work. I also need to consider that on the second find I am on another tab.
2. After finding the show, click the Right arrow should select the cell in column B, instead, again this is hardcoded to "B4".
I appreciate anyones help.
Excel 2010
Windows 7