02 - How-to

Coordinator
Oct 1, 2008 at 3:55 PM
There you can ask "how to" do something.
Jan 30, 2009 at 4:10 PM
Edited Jan 30, 2009 at 4:10 PM
hi friend,

how I make a loop in a usedrange to read all columns values
Jan 31, 2009 at 10:33 AM
Hi,
The tasks to do is to loop through the range until you reach a empty cell value.
Use Range and the start row.
Dim Sheets As Excel.Sheets = ExcelWorkBook.Worksheets

Dim sRowNbr As String = "1"
Dim Item As Excel.Range = Excel.Worksheet.Sheets.Item(1)
Dim rRange As Excel.Range = Item.Range("A" & sRowNbr, "D" & sRowNbr)
Dim aRangeData as System.Array = CType(rRange.Value2, System.Array)
'now you can loop through the array and get the data
'Example
If IsNothing(aRangeData.GetValue(1,1)) Then
'Do something with the data
End If

Regards

Guido Dupont
Expert Engineer
Damovo Belgium nv/sa

Rue De La Fusée, 40 Raketstraat

1130 Brussels

Belgium

Tel: +32 (0)2 708 85 85

Fax: +32 (0)2 708 84 33

Mail: guido.dupont@damovo.com

Web: www.damovo.be

Do more. Grow more. Be more.

This message may contain information which is confidential and/or covered by legal professional privilege. It is intended for the exclusive use of the individual or entity that is the addressee indicated in this message ; if you are not the named addressee (or responsible for delivering this message to the named addressee), you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify us immediately by e-mail, discard any paper copies and delete all electronic files of the message.

Feb 2, 2009 at 2:12 PM
thank's my friend. this code work perfect.