Good afternoon to everyone!
I have a challenge!)
I have a file, for instance in
In this file I have a list of numbers in first column like
1
2
3
4
5
6
In second one:
A
B
C
D
E
F
So, it all looks like:
1A
2B
3C
4D
5E
6F
Also I have many files (for example, about 6 .xlsx files) in "G:\1"
In every of each file in
I have a value from 1 to 6, for example)
I need to paste in every file in "G:\1" information from N.xlsx file...
In a way to have: in file with
=4 Ill get in
= "D"
Well...I have a piece of code, but I don't understand VBA syntax to end my challenge)
This code is only foggy direction of thinking how it should be. Something like:
May be I dont need vlookup at all to have my challenge done...
Please, help me to end it!
I have a challenge!)
I have a file, for instance in
Code:
[COLOR=#666666][FONT=monospace]"G:\N.xlsx"[/FONT][/COLOR]
In this file I have a list of numbers in first column like
1
2
3
4
5
6
In second one:
A
B
C
D
E
F
So, it all looks like:
1A
2B
3C
4D
5E
6F
Also I have many files (for example, about 6 .xlsx files) in "G:\1"
In every of each file in
Code:
Cells (1,1)
I need to paste in every file in "G:\1" information from N.xlsx file...
In a way to have: in file with
Code:
Cells(1,1).Value
Code:
Cell(1,2).Value
Well...I have a piece of code, but I don't understand VBA syntax to end my challenge)
This code is only foggy direction of thinking how it should be. Something like:
Code:
[COLOR=#000099][FONT=monospace]Sub[/FONT][/COLOR][COLOR=#000000][FONT=monospace] rrr()[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]Dim[/FONT][/COLOR][COLOR=#000000][FONT=monospace] wb_ [/FONT][/COLOR][COLOR=#000099][FONT=monospace]As[/FONT][/COLOR][COLOR=#000000][FONT=monospace] Workbook[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] Application.ScreenUpdating = [/FONT][/COLOR][COLOR=#000099][FONT=monospace]False[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] fp_ = [/FONT][/COLOR][COLOR=#666666][FONT=monospace]"G:\1\"[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] fv_ = [/FONT][/COLOR][COLOR=#666666][FONT=monospace]"G:\N.xlsx"[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] fvn_ = [/FONT][/COLOR][COLOR=#000099][FONT=monospace]Dir[/FONT][/COLOR][COLOR=#000000][FONT=monospace](fv_)[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] fn_ = [/FONT][/COLOR][COLOR=#000099][FONT=monospace]Dir[/FONT][/COLOR][COLOR=#000000][FONT=monospace](fp_ & [/FONT][/COLOR][COLOR=#666666][FONT=monospace]"*.xls*"[/FONT][/COLOR][COLOR=#000000][FONT=monospace], vbNormal)[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]On[/FONT][/COLOR][COLOR=#000099][FONT=monospace]Error[/FONT][/COLOR][COLOR=#000099][FONT=monospace]Resume[/FONT][/COLOR][COLOR=#000099][FONT=monospace]Next[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]Do[/FONT][/COLOR][COLOR=#000099][FONT=monospace]While[/FONT][/COLOR][COLOR=#000000][FONT=monospace] fn_ <> [/FONT][/COLOR][COLOR=#666666][FONT=monospace]""[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]Set[/FONT][/COLOR][COLOR=#000000][FONT=monospace] wb_ = [/FONT][/COLOR][COLOR=#000099][FONT=monospace]GetObject[/FONT][/COLOR][COLOR=#000000][FONT=monospace](fp_ & fn_)[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]On[/FONT][/COLOR][COLOR=#000099][FONT=monospace]Error[/FONT][/COLOR][COLOR=#000099][FONT=monospace]Resume[/FONT][/COLOR][COLOR=#000099][FONT=monospace]Next[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]With[/FONT][/COLOR][COLOR=#000000][FONT=monospace] wb_.Sheets([/FONT][/COLOR][COLOR=#666666][FONT=monospace]"rrrrr"[/FONT][/COLOR][COLOR=#000000][FONT=monospace])[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] .Cells([/FONT][/COLOR][COLOR=#CC0000][FONT=monospace]1[/FONT][/COLOR][COLOR=#000000][FONT=monospace], [/FONT][/COLOR][COLOR=#CC0000][FONT=monospace]2[/FONT][/COLOR][COLOR=#000000][FONT=monospace]) = Application.WorksheetFunction.VLookup(Cells([/FONT][/COLOR][COLOR=#CC0000][FONT=monospace]1[/FONT][/COLOR][COLOR=#000000][FONT=monospace], [/FONT][/COLOR][COLOR=#CC0000][FONT=monospace]1[/FONT][/COLOR][COLOR=#000000][FONT=monospace]), fvn_.Range([/FONT][/COLOR][COLOR=#666666][FONT=monospace]"A2:B1000"[/FONT][/COLOR][COLOR=#000000][FONT=monospace]), [/FONT][/COLOR][COLOR=#CC0000][FONT=monospace]2[/FONT][/COLOR][COLOR=#000000][FONT=monospace], [/FONT][/COLOR][COLOR=#000099][FONT=monospace]False[/FONT][/COLOR][COLOR=#000000][FONT=monospace])[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]End[/FONT][/COLOR][COLOR=#000099][FONT=monospace]With[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] wb_.Close [/FONT][/COLOR][COLOR=#000099][FONT=monospace]False[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] lr_ = [/FONT][/COLOR][COLOR=#000099][FONT=monospace]Empty[/FONT][/COLOR]
[COLOR=#000000][FONT=monospace] fn_ = [/FONT][/COLOR][COLOR=#000099][FONT=monospace]Dir[/FONT][/COLOR][COLOR=#000000][FONT=monospace]()[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]Loop[/FONT][/COLOR]
[COLOR=#000099][FONT=monospace]End[/FONT][/COLOR][COLOR=#000099][FONT=monospace]Sub[/FONT][/COLOR]
May be I dont need vlookup at all to have my challenge done...
Please, help me to end it!
Attachments
Last edited: