![]() |
The program have the same problem
This code: dim RngColD as Range, Info as Variant, Info1 as Variant Dim s as String s = "" Set RngColD = Range("D2", Range("D" & Rows.Count).End(xlUp)) Info = RngColD.Value Info1 = RngColD.Offset(0,10).Value For i = 1 to Ubound(info,1) If info(i,1) = Range("A493").Value Then If s = "" Then s = Info1(i) Else s = s & "," & Info1(i) End If End If Next i Range("I493").Value = s s = "" ..............is giving the same error as before in the declaration o "s" [s = Info1(i)] "Subscript out of range -- John2 ----------------------------------------------------------------------- John21's Profile: http://www.excelforum.com/member.php...fo&userid=3698 View this thread: http://www.excelforum.com/showthread.php?threadid=57133 |
The program have the same problem
Have you tried setting s = Nothing rather than "". Regards, Simo -- Simon Lloy ----------------------------------------------------------------------- Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670 View this thread: http://www.excelforum.com/showthread.php?threadid=57133 |
The program have the same problem
You used two dimensions when you referred to info.
If info(i,1) = Range("A493").Value Then How about trying two dimensions when you refer to info1? John21 wrote: This code: dim RngColD as Range, Info as Variant, Info1 as Variant Dim s as String s = "" Set RngColD = Range("D2", Range("D" & Rows.Count).End(xlUp)) Info = RngColD.Value Info1 = RngColD.Offset(0,10).Value For i = 1 to Ubound(info,1) If info(i,1) = Range("A493").Value Then If s = "" Then s = Info1(i) Else s = s & "," & Info1(i) End If End If Next i Range("I493").Value = s s = "" .............is giving the same error as before in the declaration of "s" [s = Info1(i)] "Subscript out of range" -- John21 ------------------------------------------------------------------------ John21's Profile: http://www.excelforum.com/member.php...o&userid=36983 View this thread: http://www.excelforum.com/showthread...hreadid=571331 -- Dave Peterson |
All times are GMT +1. The time now is 01:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com