G
GTyson2
The Following is a code I wrote to try and Lookup information from one
workbook and copy and paste that exact information into another workbook. But
I'm having issues with my Formula for Z. I'm trying to use the Match funtion
in excel since it gives you the row number, and my column is going to be
static. Can someone help me out here?
Sub Match()
x = 4
y = 2
b = 14
Dim fName As String
fName = Application.GetOpenFilename()
Workbooks.Open Filename:=fName
Sheets("Accounting_Teams").Select
Sheets("Accounting_Teams").Copy Before:=Workbooks( _
"Tracker-Test.xls").Sheets(1)
Do While Cells(x, y).Value <> ""
z = Formula = "=Match(Cells(X,
Y),Sheets(""Accounting_Teams"").Columns(""C:C""),0)"
Sheets("Accounting_Teams").Select
Cells(z, 20).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(x, b).Select
ActiveSheet.Paste
x = x + 1
Loop
Applications.CutCopyMode = False
Sheets("Accounting_Teams").Select
ActiveWindow.SelectedSheets.Delete
End Sub
workbook and copy and paste that exact information into another workbook. But
I'm having issues with my Formula for Z. I'm trying to use the Match funtion
in excel since it gives you the row number, and my column is going to be
static. Can someone help me out here?
Sub Match()
x = 4
y = 2
b = 14
Dim fName As String
fName = Application.GetOpenFilename()
Workbooks.Open Filename:=fName
Sheets("Accounting_Teams").Select
Sheets("Accounting_Teams").Copy Before:=Workbooks( _
"Tracker-Test.xls").Sheets(1)
Do While Cells(x, y).Value <> ""
z = Formula = "=Match(Cells(X,
Y),Sheets(""Accounting_Teams"").Columns(""C:C""),0)"
Sheets("Accounting_Teams").Select
Cells(z, 20).Select
Selection.Copy
Sheets("Sheet1").Select
Cells(x, b).Select
ActiveSheet.Paste
x = x + 1
Loop
Applications.CutCopyMode = False
Sheets("Accounting_Teams").Select
ActiveWindow.SelectedSheets.Delete
End Sub