General discussion

Locked

Excel VBA - Scan Column Range

By crispin_yuen ·
Hello

I need to amend the range of columns. Instead of going from G to L, I need it to go from G to J, and include L. That means Column K is omited. Here is the code:

For i = 103 To 108 'Column G to L 103-108
Worksheets("SGAUST").Activate
If Len(Range(Chr(i) & intActiveRow).Value) < 2 Then
Else
intSeq = intSeq + 1
strETA = Convert_Date(CDate(Range(Chr(i) & intActiveRow).Value))
strPort = Convert_Port(CStr(Range(Chr(i) & PORTROW).Value))

What should I do? I tried to change to:

For i = 103 To 106 & 108

But I had an error on the Len line. Pls advise.

Thanks in advance.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Excel VBA - Scan Column Range

by nikki96 In reply to Excel VBA - Scan Column R ...

Just skip over it.

For i = 103 To 108 'Column G to L 103-108, exclude K
If i != 107 Then
Worksheets("SGAUST").Activate
If Len(Range(Chr(i) & intActiveRow).Value) < 2 Then
Else
intSeq = intSeq + 1
strETA = Convert_Date(CDate(Range(Chr(i) & intActiveRow).Value))
strPort = Convert_Port(CStr(Range(Chr(i) & PORTROW).Value))
End If

HTH

Collapse -

Excel VBA - Scan Column Range

by crispin_yuen In reply to Excel VBA - Scan Column R ...

Thanks for your reply. I tried your solution, but I got a return error. Do I need to place a GoTo after If i!=107 Then? I managed to get a solution to this, by placing If i=107, exist function. This works fine. Thanks to Paul! But thank you for youradvise.

Collapse -

Excel VBA - Scan Column Range

by crispin_yuen In reply to Excel VBA - Scan Column R ...

This question was closed by the author

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums