jaylotheman
New Member
- Joined
- Oct 5, 2011
- Messages
- 7
Hello,
So basically I have the following code:
I've attached the sheet along with this code here: https://docs.google.com/leaf?id=0B1...Y2UyOS00NjU2LTlkYjYtM2U0NDQ1MzBlMDVh&hl=en_US, but what I'm doing at the moment is finding a cell in one sheet and copying/pasting it into another sheet by looking for the same name...however as you'll notice in the spreadsheet attached I have a drop-down menu in the first sheet which designates the month for the value to be inputted and in the other sheets there's separate columns for each month...basically instead of copying/pasting data and just simply offsetting by row, how can I match it to the column that correlated to the drop-down menu?
Any help would be appreciated, thanks!
Originally posted here: http://www.ozgrid.com/forum/showthread.php?t=158888&p=579213#post579213
And also found here: http://stackoverflow.com/questions/...et-to-another-and-offset-by-month-dropdown-vb
So basically I have the following code:
Code:
Sub FindStr()
Dim stFd As String
Dim stDg As String
Dim sh As Worksheet
Dim ws As Worksheet
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Lubricant A"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Lubricant B"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Lubricant C"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Lubricant D"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Combined Lubricants"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Other"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid A"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid B"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid C"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid D"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid E"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid F"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid G"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid H"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid I"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Fluid J"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Revenue Generated Before Tax"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Tax"
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Tax Variance"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Revenue Generated After Tax"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Other Revenue"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).Copy
sh.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 1).PasteSpecial xlPasteValues
End With
'Lubricant A
Set ws = Sheets("Input View")
Set sh = Sheets("Financial_View_1")
stFd = "Budget"
stDg = "Lubricant ABudget"
With sh
ws.Cells.Find(stFd, LookIn:=xlValues, LookAt:=xlWhole).Offset(2, 0).Copy
sh.Cells.Find(stDg, LookIn:=xlValues, LookAt:=xlWhole).Offset(0, 3).PasteSpecial xlPasteValues
End With
End Sub
Any help would be appreciated, thanks!
Originally posted here: http://www.ozgrid.com/forum/showthread.php?t=158888&p=579213#post579213
And also found here: http://stackoverflow.com/questions/...et-to-another-and-offset-by-month-dropdown-vb