ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use vba to fill in matrix in excel. (https://www.excelbanter.com/excel-programming/353088-use-vba-fill-matrix-excel.html)

[email protected]

Use vba to fill in matrix in excel.
 
I have a matrix format in excel that i need to fill in with a formula.
I was wondering if there was any vba code that could help me with this.
Example,

Policy Number Name Date

429438
975288
759284

I am going to be using a lookup function to fill in name and date, I
was hoping to get code that evaluates the # of fields and rows first
then copies in the encompassing cells. Thanks for the help.


Tom Ogilvy

Use vba to fill in matrix in excel.
 
set rng = Range(Cells(2,1),Cells(2,1).End(xldown))
rng.offset(0,1).Formula = "=Vlookup(A2,Sheet2!$A$1:$C4200,2,False))"
rng.offset(0,2).Formula = "=Vlookup(A2,Sheet2!$A$1:$C4200,3,False))"

--
Regards,
Tom Ogilvy



wrote in message
oups.com...
I have a matrix format in excel that i need to fill in with a formula.
I was wondering if there was any vba code that could help me with this.
Example,

Policy Number Name Date

429438
975288
759284

I am going to be using a lookup function to fill in name and date, I
was hoping to get code that evaluates the # of fields and rows first
then copies in the encompassing cells. Thanks for the help.




Tom Ogilvy

Use vba to fill in matrix in excel.
 
Got an extra ")" in there and a 4 instead of a $

set rng = Range(Cells(2,1),Cells(2,1).End(xldown))
rng.offset(0,1).Formula = "=Vlookup(A2,Sheet2!$A$1:$C$200,2,False)"
rng.offset(0,2).Formula = "=Vlookup(A2,Sheet2!$A$1:$C$200,3,False)"

--
Regards,
Tom Ogivly

"Tom Ogilvy" wrote in message
...
set rng = Range(Cells(2,1),Cells(2,1).End(xldown))
rng.offset(0,1).Formula = "=Vlookup(A2,Sheet2!$A$1:$C4200,2,False))"
rng.offset(0,2).Formula = "=Vlookup(A2,Sheet2!$A$1:$C4200,3,False))"

--
Regards,
Tom Ogilvy



wrote in message
oups.com...
I have a matrix format in excel that i need to fill in with a formula.
I was wondering if there was any vba code that could help me with this.
Example,

Policy Number Name Date

429438
975288
759284

I am going to be using a lookup function to fill in name and date, I
was hoping to get code that evaluates the # of fields and rows first
then copies in the encompassing cells. Thanks for the help.







All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com