View Full Version : Excel VBA
TinByte
10-13-2005, 8:35 PM
In MS Excel you can use to sources for programming: 1. In cell, 2. VBA
You can combine both.
Their is a cell function (VLOOKUP) to find and match information within the spreadsheet.
I would like to know how can I do this but within the VB enviroment using a array.
:)
Win2Kuser
11-21-2005, 5:07 AM
Hi TinByte,
From what I can see, the VLOOKUP command is an internal section of code that looks down the rows until it matches the string required, then moves along to the column requested and returns the value.
Unfortunately, in VBA there is no direct replacement for the cell command, you will have to do it manually;
do while cellvalue <> ""
row=row+1
with worksheets("sheetname").cells(row,column)
cellvalue=.value
end with
if cellvalue=stringtofind then
for t=column to columnend
with worksheets("sheetname").cells(row,t)
stringarray(t)=.value
end with
next t
end if
loop
I haven't tested the above routine, but you should get the basics behind it...
Hope it helps.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.