Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default strange behaviour

Hi Dave,

This might not help at all but I have experienced strange behaviour with
assigning ranges to variables when trying to do it in one line like the
following.

Set rLookUpRange = Sheets("identification").Range("a:d")

Changing code to following then worked perfectly. I have no explanation for
it because I would have thought that both are the same thing but the
following worked as expected and the above method didn't.

With Sheets("identification")
Set rLookUpRange = .Range("a:d")
End With

Also with the following code and loop to find the first blank cell. Are
there any other cells with data below the first blank one?

Set vNewrisk = Sheets("Treatment - Controls").Range("a8")
lLineCount = 8

Do Until vNewrisk.Value = "" ' look for first blank cell
Set vNewrisk = vNewrisk.Offset(1, 0)
lLineCount = lLineCount + 1
Loop

If no other cells below with data then you could do it this way without the
loop.

With Sheets("Treatment - Controls")
Set vNewrisk = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With
lLineCount = vNewrisk.Row


--
Regards,

OssieMac


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
Strange if(***) behaviour? Excel 2003 - SPB Excel Discussion (Misc queries) 6 August 6th 06 05:34 PM
Strange VBA Behaviour Ricko Excel Programming 0 July 28th 05 07:53 AM
Strange behaviour Edgar Thoemmes Excel Worksheet Functions 1 February 8th 05 03:20 PM
Strange behaviour in VBA Help Michael Singmin Excel Programming 4 June 4th 04 07:06 PM
strange behaviour Patrick Molloy Excel Programming 0 September 4th 03 07:51 AM


All times are GMT +1. The time now is 12: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"