Parsing blocks of cells using VBA

G

Gordon Filby

Hello,

I have a large amount of bibliographic data (ca. 1000 rows and 5 or 6
columns) in csv format saved in Excel tables. After filtering out what I
need I want to save the filtered data for archiving, say 20-30 rows at a
time. I parse text from column 1 and then from column 5 or 6 and then I want
to save it as a record.

In other words in pidgin pseudocode

For all the rows selected
get some stuff from column 1 and then move to column 5 or 6 depending on
whether a certain value is in one of them
then move to next row down
carry on until all rows have been processed

Having looked at several books I am completely bamboozled about what to use:
range, offset.

Can anyone give me a start?

Many thanks,

Gordon Filby
 
B

Barb Reinhardt

Try something like this on a COPY Of your workbook

dim myRange as range
dim r as range

lrow = cells(rows.count,1).end(xlup).row
set myRange = cells(1,1).resize(lrow,1)

for each r in myrange
'Get some stuff
Value = r.value 'I'm not sure what you are doing here, so will leave it to
you.
'Move to Column 5 or 6

If condition then
Cells(r.row,5)value = Vlue
else
Cells(r.row,6).value = value
end if
next r
 
G

Gordon Filby

Hallo,

Looks to be exactly what I need. I didn't know about resize. Easy when you
know how. I'll try it on the copy and let you know.

Thanks for the very prompt response.

Best Regards,

Gordon Filby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top