Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Finding the next blank cell

Hi,

Can someone please explain why this throws up an error "Select method of
range class failed" (on the .Select line)

Sheets("ChartsM").Cells(5000, "N").End(xlUp).Select
Set rCurrentCell = ActiveCell

I have repace it with:

Do
Set rCurrentCell = rCurrentCell.Offset(1, 0)
Loop Until rCurrentCell.Value = ""

which works, but I'd like to undersand what I'm doing wrong.

TIA

Dave
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding the next blank cell


You would get the error if the cell is protected. A set statement
doesn't select the cell so you don't get the error. Besides the example
that works is going to the row after the protected line. I assume you
must have a header row that is protected and you are trying to add a new
row at the end of your data. You will only get the error when you add
the first row of data after the header.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=153386

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Finding the next blank cell

Hi Dave

If the sheet is not activated and you try to select a cell; it will return
an error. In the second method you are not trying to select and hence it
works.

Either try
Set rcurrentcell = Sheets("ChartsM").Cells(5000, "N").End(xlUp)

OR
Select the sheet and then try selecting the cell using your code.

If this post helps click Yes
---------------
Jacob Skaria


"Risky Dave" wrote:

Hi,

Can someone please explain why this throws up an error "Select method of
range class failed" (on the .Select line)

Sheets("ChartsM").Cells(5000, "N").End(xlUp).Select
Set rCurrentCell = ActiveCell

I have repace it with:

Do
Set rCurrentCell = rCurrentCell.Offset(1, 0)
Loop Until rCurrentCell.Value = ""

which works, but I'd like to undersand what I'm doing wrong.

TIA

Dave

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Finding the next blank cell

You would get the error if the cell is protected. A set statement doesn't
select the cell so you don't get the error. Besides the example that works
is going to the row after the protected line. I assume you must have a
header row that is protected and you are trying to add a new row at the end
of your data. You will only get the error when you add the first row of data
after the header.

"Risky Dave" wrote:

Hi,

Can someone please explain why this throws up an error "Select method of
range class failed" (on the .Select line)

Sheets("ChartsM").Cells(5000, "N").End(xlUp).Select
Set rCurrentCell = ActiveCell

I have repace it with:

Do
Set rCurrentCell = rCurrentCell.Offset(1, 0)
Loop Until rCurrentCell.Value = ""

which works, but I'd like to undersand what I'm doing wrong.

TIA

Dave

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
Finding Next Blank Cell in Blank Row Nick Wakeham Excel Worksheet Functions 3 June 11th 08 02:15 PM
Finding next non-blank cell Stu[_2_] Excel Discussion (Misc queries) 4 October 23rd 07 01:29 PM
Finding next blank cell JaiD Excel Programming 2 June 13th 04 10:23 AM
Finding the Blank Cell Cory Thomas[_2_] Excel Programming 0 June 2nd 04 05:54 PM
Finding first non-blank cell Allison[_2_] Excel Programming 7 October 18th 03 01:47 AM


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

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

About Us

"It's about Microsoft Excel"