D
Dani Lima
Hey.. I am a brend new user of excell programming, and I still have lost of
difficults to write codes.
Could someone help me again??
I am trying to look for some datas of an workbook on another one.
I can't fix the name of the file because it changes according to the file I
am working, so I've listed all of them (address on my computer and name) in a
worksheet.
Now comes the problem, I have to write the code (vlook up (what), (where)
etc..) but how do I write the "where"???
The code:
Windows("Prazos de entrega_matriz").Activate
Sheets("Extract BD").Select
Workbooks.Open Filename:="" & Range("N7") & "\" & Range("O7") & ".xls"
Windows("Prazos de entrega_matriz").Activate
Sheets("Extract BD").Select
Workbooks.Open Filename:="" & Range("H7") & "\" & Range("I7") & ".xls"
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B2").Select
ActiveCell.FormulaR1C1 = "=RC[1]&RC[3]"
Range("B2").Select
Selection.Copy
Range("B3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Columns("B:B").Select
Application.CutCopyMode = False
Selection.Copy
Columns("B:B").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("I4").Select
'write the time spent to deliver
Windows("Prazos de entrega_matriz").Activate
Sheets("Extract BD").Select
Windows("" & Sheets("Extract BD").Range("O7") & ".xls").Activate
Sheets("Produtos em Estoque").Activate
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Range("A2").Select
ActiveCell.FormulaR1C1 = "=RC[2]&RC[4]"
Range("A2").Select
Selection.Copy
Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Columns("A:A").Select
Application.CutCopyMode = False
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C13").Select
Application.CutCopyMode = False
Range("A3").Select
ActiveWorkbook.Names.Add Name:="Valor", RefersToR1C1:= _
"='Produtos em Estoque'!R2C1:R65536C6"
Windows("Prazos de entrega_matriz").Activate
Sheets("Extract BD").Select
Windows("" & Sheets("Extract BD").Range("I7") & ".xls").Activate
Range("L2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(VLOOKUP(RC[-11],????,valor,1,FALSE)),"""",""24"")"
difficults to write codes.
Could someone help me again??
I am trying to look for some datas of an workbook on another one.
I can't fix the name of the file because it changes according to the file I
am working, so I've listed all of them (address on my computer and name) in a
worksheet.
Now comes the problem, I have to write the code (vlook up (what), (where)
etc..) but how do I write the "where"???
The code:
Windows("Prazos de entrega_matriz").Activate
Sheets("Extract BD").Select
Workbooks.Open Filename:="" & Range("N7") & "\" & Range("O7") & ".xls"
Windows("Prazos de entrega_matriz").Activate
Sheets("Extract BD").Select
Workbooks.Open Filename:="" & Range("H7") & "\" & Range("I7") & ".xls"
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B2").Select
ActiveCell.FormulaR1C1 = "=RC[1]&RC[3]"
Range("B2").Select
Selection.Copy
Range("B3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Columns("B:B").Select
Application.CutCopyMode = False
Selection.Copy
Columns("B:B").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("I4").Select
'write the time spent to deliver
Windows("Prazos de entrega_matriz").Activate
Sheets("Extract BD").Select
Windows("" & Sheets("Extract BD").Range("O7") & ".xls").Activate
Sheets("Produtos em Estoque").Activate
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Range("A2").Select
ActiveCell.FormulaR1C1 = "=RC[2]&RC[4]"
Range("A2").Select
Selection.Copy
Range("A3").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Columns("A:A").Select
Application.CutCopyMode = False
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C13").Select
Application.CutCopyMode = False
Range("A3").Select
ActiveWorkbook.Names.Add Name:="Valor", RefersToR1C1:= _
"='Produtos em Estoque'!R2C1:R65536C6"
Windows("Prazos de entrega_matriz").Activate
Sheets("Extract BD").Select
Windows("" & Sheets("Extract BD").Range("I7") & ".xls").Activate
Range("L2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(VLOOKUP(RC[-11],????,valor,1,FALSE)),"""",""24"")"