jerry12302
Active Member
- Joined
- Apr 18, 2005
- Messages
- 449
- Office Version
- 2010
- Platform
- Windows
I can't seem to get this code to select a cell within a ws loop, can someone review this and tell me what's needed?
Thanks
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> test()
<SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> Ws <SPAN style="color:#00007F">In</SPAN> Worksheets
<SPAN style="color:#00007F">If</SPAN> Ws.Index <> 1 <SPAN style="color:#00007F">Then</SPAN>
Ws.Unprotect
Worksheets(1).Range("D36:D37").Copy Ws.Range("D36")
Ws.Protect
<SPAN style="color:#007F00">'This is working perfectly until the next line where it crashes:</SPAN>
Ws.Range("C5").Select
<SPAN style="color:#007F00">'How do I get the cellpointer at C5 (with A1 being at the upper left</SPAN>
<SPAN style="color:#007F00">'corner) in each worksheet?</SPAN>
<SPAN style="color:#007F00">'</SPAN>
<SPAN style="color:#007F00">'Alternately, what if I wanted B107 in the upper left corner and the</SPAN>
<SPAN style="color:#007F00">'cellpointer at G127?</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">Next</SPAN> Ws
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
Thanks
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> test()
<SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> Ws <SPAN style="color:#00007F">In</SPAN> Worksheets
<SPAN style="color:#00007F">If</SPAN> Ws.Index <> 1 <SPAN style="color:#00007F">Then</SPAN>
Ws.Unprotect
Worksheets(1).Range("D36:D37").Copy Ws.Range("D36")
Ws.Protect
<SPAN style="color:#007F00">'This is working perfectly until the next line where it crashes:</SPAN>
Ws.Range("C5").Select
<SPAN style="color:#007F00">'How do I get the cellpointer at C5 (with A1 being at the upper left</SPAN>
<SPAN style="color:#007F00">'corner) in each worksheet?</SPAN>
<SPAN style="color:#007F00">'</SPAN>
<SPAN style="color:#007F00">'Alternately, what if I wanted B107 in the upper left corner and the</SPAN>
<SPAN style="color:#007F00">'cellpointer at G127?</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">Next</SPAN> Ws
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>