![]() |
Parsing blocks of cells using VBA
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 |
Parsing blocks of cells using VBA
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 "Gordon Filby" wrote: 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 |
Parsing blocks of cells using VBA
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 "Barb Reinhardt" schrieb im Newsbeitrag ... 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 "Gordon Filby" wrote: 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 |
All times are GMT +1. The time now is 03:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com