Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Basic Code Problem


I have a small problem with one line of code.

Do While ActiveCell.Row < rw


It is part of a loop that works but I need it to use the active cell
from a certain sheet (Carriage). I have tried it as below but it doesnt
work. Think this is just a basic code error but can't work it out.

Do While Sheets("Carriage").ActiveCell.Row < rw

Thanks.

James


--
fugfug
------------------------------------------------------------------------
fugfug's Profile: http://www.excelforum.com/member.php...o&userid=24950
View this thread: http://www.excelforum.com/showthread...hreadid=389017

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Basic Code Problem


Good afternoon FugFug

Your code is correct, however the ActiveCell is the currently selected
cell in the currently selected sheet, so you cannot tell Excel to find
the activecell in a diiferent sheet - that is why the error is
returned. You will need to reference the address direct or load it
into a variable and call it that way.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=389017

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Basic Code Problem

Try something like

Dim Rng As Range
Set Rng = Sheets("Carriage").ActiveCell
While Rng.Row < rw
' do something
Set Rng = Rng(2,1)
Loop


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"fugfug"
wrote in message
...

I have a small problem with one line of code.

Do While ActiveCell.Row < rw


It is part of a loop that works but I need it to use the active
cell
from a certain sheet (Carriage). I have tried it as below but
it doesnt
work. Think this is just a basic code error but can't work it
out.

Do While Sheets("Carriage").ActiveCell.Row < rw

Thanks.

James


--
fugfug
------------------------------------------------------------------------
fugfug's Profile:
http://www.excelforum.com/member.php...o&userid=24950
View this thread:
http://www.excelforum.com/showthread...hreadid=389017



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Basic Code Problem

Maybe...

Sheets("Carriage").select
Do While ActiveCell.Row < rw
....



fugfug wrote:

I have a small problem with one line of code.

Do While ActiveCell.Row < rw

It is part of a loop that works but I need it to use the active cell
from a certain sheet (Carriage). I have tried it as below but it doesnt
work. Think this is just a basic code error but can't work it out.

Do While Sheets("Carriage").ActiveCell.Row < rw

Thanks.

James

--
fugfug
------------------------------------------------------------------------
fugfug's Profile: http://www.excelforum.com/member.php...o&userid=24950
View this thread: http://www.excelforum.com/showthread...hreadid=389017


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic code Pickle Excel Discussion (Misc queries) 1 September 4th 08 03:35 PM
I need a visual basic code....please Rhonda Excel Discussion (Misc queries) 1 March 5th 07 01:18 PM
Visual basic Code GRobertson Excel Programming 3 January 10th 05 02:16 PM
visual basic code Whitey Excel Programming 1 October 26th 04 04:05 PM
Visual Basic Code Robert Couchman Excel Programming 2 February 2nd 04 03:10 PM


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"