pushing data from one sheet to another

rajrbr

Board Regular
Joined
Nov 21, 2008
Messages
95
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:eek:ffice:eek:ffice" /><o:p></o:p></PRE>
Dim uRng, v As Variant, i As Long, w(1 To 250)<o:p></o:p></PRE>
Dim DestCell As Range, ws As Worksheet<o:p></o:p></PRE>
Const pWord As String = "pwrd" 'your sheet password<o:p></o:p></PRE>
Set ws = Sheets("MASTER")<o:p></o:p></PRE>
Set DestCell = ws.Range("b" & Rows.Count).End(xlUp).Offset(1)<o:p></o:p></PRE>
uRng = Array("b6", "h5", "h6", "l5", "m7", "s7", "g13", "i13", "k13", "l13", _<o:p></o:p></PRE>
"m13", "n13", "o13", "g15", "i15", "k15", "l15", "m15", "n15", "o15", "g17", _<o:p></o:p></PRE>
"h17", "i17", "j17", "k17", "l17", "m17", "n17", "o17", "g19", "h19", "I19", _<o:p></o:p></PRE>
"j19", "k19", "l19", "m19", "n19", "o19", "g21", "i21", "k21", "l21", "m21", _<o:p></o:p></PRE>
"n21", "o21", "g23", "I23", "k23", "l23", "m23", "n23", "o23", "g25", "i25", _<o:p></o:p></PRE>
"k25", "l25", "m25", "n25", "o25", "b32", "h33"......upto 250th cell)<o:p></o:p></PRE>
For i = 0 To UBound(uRng)<o:p></o:p></PRE>
If Len(Range(uRng(i))) = 0 Then<o:p></o:p></PRE>
MsgBox uRng(i) & " can't be empty"<o:p></o:p></PRE>
Range(uRng(i)).Activate<o:p></o:p></PRE>
Exit Sub<o:p></o:p></PRE>
Else<o:p></o:p></PRE>
w(i + 1) = Range(uRng(i)).Value<o:p></o:p></PRE>
End If<o:p></o:p></PRE>
Next<o:p></o:p></PRE>
'unprotect worksheet<o:p></o:p></PRE>
ws.Unprotect password:=pWord<o:p></o:p></PRE>
DestCell.Resize(, 250).Value = w<o:p></o:p></PRE>
DestCell.Offset(, -1).Value = DestCell.Row - 3<o:p></o:p></PRE>
ws.Protect password:=pWord 'protect sheet<o:p></o:p></PRE>
For i = 0 To UBound(uRng)<o:p></o:p></PRE>
Select Case i<o:p></o:p></PRE>
Case 2, 6 'here goes your vlookup ranges(nos). e.g.2 and 3 <o:p></o:p></PRE>
are h6 and g13<o:p></o:p></PRE>
Case Else<o:p></o:p></PRE>
Range(uRng(i)) = ""<o:p></o:p></PRE>
End Select<o:p></o:p></PRE>
Next<o:p></o:p></PRE>
End Sub<o:p></o:p></PRE> <o:p></o:p>
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
At a quick glance
Dim uRng, v As Variant, i As Long, w(1 To 250)

you don't have a definition to type on uRng
 
Upvote 0
what all i wanted is
i have two sheets
one tamplet ( with many formulas) and another is storage.

i want to push data ( selected cells of tamplet) to sheet2 ( horizantally)
and both sheets are to be protected with password.
raj
 
Upvote 0
hi
teaxasalynn

i will try that today

u mean to say it not required to define?

raj

no needs to have something like

Dim uRng as Range

I didn't have time to study your problem in detail, just saw that at a quick glance
 
Upvote 0

Forum statistics

Threads
1,203,472
Messages
6,055,610
Members
444,803
Latest member
retrorocket129

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top