hi i got struck in below code
the below code shows error
in
uring = array("b6"...........upto 250 cells) BUTIT TAKES ONLY UPTO 146 cells i have 250-400 celss to push.
many thnaks in advance.
raj
Sub StoreData()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
></PRE>
Dim uRng, v As Variant, i As Long, w(1 To 250)<o
></o
></PRE>
Dim DestCell As Range, ws As Worksheet<o
></o
></PRE>
Const pWord As String = "pwrd" 'your sheet password<o
></o
></PRE>
Set ws = Sheets("MASTER")<o
></o
></PRE>
Set DestCell = ws.Range("b" & Rows.Count).End(xlUp).Offset(1)<o
></o
></PRE>
uRng = Array("b6", "h5", "h6", "l5", "m7", "s7", "g13", "i13", "k13", "l13", _<o
></o
></PRE>
"m13", "n13", "o13", "g15", "i15", "k15", "l15", "m15", "n15", "o15", "g17", _<o
></o
></PRE>
"h17", "i17", "j17", "k17", "l17", "m17", "n17", "o17", "g19", "h19", "I19", _<o
></o
></PRE>
"j19", "k19", "l19", "m19", "n19", "o19", "g21", "i21", "k21", "l21", "m21", _<o
></o
></PRE>
"n21", "o21", "g23", "I23", "k23", "l23", "m23", "n23", "o23", "g25", "i25", _<o
></o
></PRE>
"k25", "l25", "m25", "n25", "o25", "b32", "h33"......upto 250th cell)<o
></o
></PRE>
For i = 0 To UBound(uRng)<o
></o
></PRE>
If Len(Range(uRng(i))) = 0 Then<o
></o
></PRE>
MsgBox uRng(i) & " can't be empty"<o
></o
></PRE>
Range(uRng(i)).Activate<o
></o
></PRE>
Exit Sub<o
></o
></PRE>
Else<o
></o
></PRE>
w(i + 1) = Range(uRng(i)).Value<o
></o
></PRE>
End If<o
></o
></PRE>
Next<o
></o
></PRE>
'unprotect worksheet<o
></o
></PRE>
ws.Unprotect password:=pWord<o
></o
></PRE>
DestCell.Resize(, 250).Value = w<o
></o
></PRE>
DestCell.Offset(, -1).Value = DestCell.Row - 3<o
></o
></PRE>
ws.Protect password:=pWord 'protect sheet<o
></o
></PRE>
For i = 0 To UBound(uRng)<o
></o
></PRE>
Select Case i<o
></o
></PRE>
Case 2, 6 'here goes your vlookup ranges(nos). e.g.2 and 3 <o
></o
></PRE>
are h6 and g13<o
></o
></PRE>
Case Else<o
></o
></PRE>
Range(uRng(i)) = ""<o
></o
></PRE>
End Select<o
></o
></PRE>
Next<o
></o
></PRE>
End Sub<o
></o
></PRE> <o
></o
>
the below code shows error
in
uring = array("b6"...........upto 250 cells) BUTIT TAKES ONLY UPTO 146 cells i have 250-400 celss to push.
many thnaks in advance.
raj
Sub StoreData()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
Dim uRng, v As Variant, i As Long, w(1 To 250)<o
Dim DestCell As Range, ws As Worksheet<o
Const pWord As String = "pwrd" 'your sheet password<o
Set ws = Sheets("MASTER")<o
Set DestCell = ws.Range("b" & Rows.Count).End(xlUp).Offset(1)<o
uRng = Array("b6", "h5", "h6", "l5", "m7", "s7", "g13", "i13", "k13", "l13", _<o
"m13", "n13", "o13", "g15", "i15", "k15", "l15", "m15", "n15", "o15", "g17", _<o
"h17", "i17", "j17", "k17", "l17", "m17", "n17", "o17", "g19", "h19", "I19", _<o
"j19", "k19", "l19", "m19", "n19", "o19", "g21", "i21", "k21", "l21", "m21", _<o
"n21", "o21", "g23", "I23", "k23", "l23", "m23", "n23", "o23", "g25", "i25", _<o
"k25", "l25", "m25", "n25", "o25", "b32", "h33"......upto 250th cell)<o
For i = 0 To UBound(uRng)<o
If Len(Range(uRng(i))) = 0 Then<o
MsgBox uRng(i) & " can't be empty"<o
Range(uRng(i)).Activate<o
Exit Sub<o
Else<o
w(i + 1) = Range(uRng(i)).Value<o
End If<o
Next<o
'unprotect worksheet<o
ws.Unprotect password:=pWord<o
DestCell.Resize(, 250).Value = w<o
DestCell.Offset(, -1).Value = DestCell.Row - 3<o
ws.Protect password:=pWord 'protect sheet<o
For i = 0 To UBound(uRng)<o
Select Case i<o
Case 2, 6 'here goes your vlookup ranges(nos). e.g.2 and 3 <o
are h6 and g13<o
Case Else<o
Range(uRng(i)) = ""<o
End Select<o
Next<o
End Sub<o