PC Review


Reply
Thread Tools Rate Thread

CurrentRegion issue (attempt 2)

 
 
Barb Reinhardt
Guest
Posts: n/a
 
      12th Dec 2007
Let's try this again.

I have the following code:

Set mySourceRange = mySourceRange.CurrentRegion

where mySourceRange is already a defined range. There is a region of data
that's bounded by blank cells, but it only seems to find the first row of
data and I can't seem to figure out why.

Can someone assist?

Thanks,
Barb Reinhardt


 
Reply With Quote
 
 
 
 
Tim Zych
Guest
Posts: n/a
 
      12th Dec 2007
Is this in a UDF called from a worksheet cell? If so it can't use
CurrentRegion.

--
Tim Zych
SF, CA

"Barb Reinhardt" <(E-Mail Removed)> wrote in message
news:C20E2A02-5C7D-49C8-9302-(E-Mail Removed)...
> Let's try this again.
>
> I have the following code:
>
> Set mySourceRange = mySourceRange.CurrentRegion
>
> where mySourceRange is already a defined range. There is a region of
> data
> that's bounded by blank cells, but it only seems to find the first row of
> data and I can't seem to figure out why.
>
> Can someone assist?
>
> Thanks,
> Barb Reinhardt
>
>



 
Reply With Quote
 
Sandusky
Guest
Posts: n/a
 
      12th Dec 2007

"Barb Reinhardt" <(E-Mail Removed)> wrote in message
news:C20E2A02-5C7D-49C8-9302-(E-Mail Removed)...
> Let's try this again.
>
> I have the following code:
>
> Set mySourceRange = mySourceRange.CurrentRegion
>
> where mySourceRange is already a defined range. There is a region of
> data
> that's bounded by blank cells, but it only seems to find the first row of
> data and I can't seem to figure out why.
>
> Can someone assist?
>
> Thanks,
> Barb Reinhardt


Try clearing range object first. If MySourceRange is already assigned a
range object, then MySourceRange.CurrentRegion will try to find the current
region with the already defined range.

Or...do you have any rows hidden? Any AutoFilters in place?


 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      12th Dec 2007
Barb, This worked for me.

Sub currgn()
Set myRng = Range("C9:C11")
myRng.CurrentRegion.Interior.ColorIndex = 3
MsgBox "Take a look"
myRng.CurrentRegion.Interior.ColorIndex = xlNone
End Sub

So it has nothing to do with having a previously defined range, apparently.
Must be some other quirk.

"Barb Reinhardt" wrote:

> Let's try this again.
>
> I have the following code:
>
> Set mySourceRange = mySourceRange.CurrentRegion
>
> where mySourceRange is already a defined range. There is a region of data
> that's bounded by blank cells, but it only seems to find the first row of
> data and I can't seem to figure out why.
>
> Can someone assist?
>
> Thanks,
> Barb Reinhardt
>
>

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      12th Dec 2007
Let me try this again. I set up an area of about 10 colums by 12 rows. Then
I used this macro with the variable re-set to include CurrentRegion and it
worked OK.


Sub currgn()
Set myRng = Range("C9:C11")
Set myRng = myRng.CurrentRegion
myRng.Interior.ColorIndex = 3
MsgBox "Take a look"
myRng.CurrentRegion.Interior.ColorIndex = xlNone
End Sub

"Barb Reinhardt" wrote:

> Let's try this again.
>
> I have the following code:
>
> Set mySourceRange = mySourceRange.CurrentRegion
>
> where mySourceRange is already a defined range. There is a region of data
> that's bounded by blank cells, but it only seems to find the first row of
> data and I can't seem to figure out why.
>
> Can someone assist?
>
> Thanks,
> Barb Reinhardt
>
>

 
Reply With Quote
 
sebastienm
Guest
Posts: n/a
 
      12th Dec 2007
Hi,
I believe CurrentRegion is based on the first cell of the range object, i.e.
mySourceRange.CurrentRegion in fact does
mySourceRange.cells(1).CurretRegion
That is, even through mySourceRange contains 100 rows of data and 20
columns, if the second row is blank, CurrentRegion returns the first row only.
Are you in this case?
--
Regards,
Sébastien
<http://www.ondemandanalysis.com>


"Barb Reinhardt" wrote:

> Let's try this again.
>
> I have the following code:
>
> Set mySourceRange = mySourceRange.CurrentRegion
>
> where mySourceRange is already a defined range. There is a region of data
> that's bounded by blank cells, but it only seems to find the first row of
> data and I can't seem to figure out why.
>
> Can someone assist?
>
> Thanks,
> Barb Reinhardt
>
>

 
Reply With Quote
 
Barb Reinhardt
Guest
Posts: n/a
 
      13th Dec 2007
I discovered that my problem was a "user error" (mine).
Thanks to all,
Barb Reinhardt


"Barb Reinhardt" wrote:

> Let's try this again.
>
> I have the following code:
>
> Set mySourceRange = mySourceRange.CurrentRegion
>
> where mySourceRange is already a defined range. There is a region of data
> that's bounded by blank cells, but it only seems to find the first row of
> data and I can't seem to figure out why.
>
> Can someone assist?
>
> Thanks,
> Barb Reinhardt
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Currentregion issue Barb Reinhardt Microsoft Excel Programming 0 12th Dec 2007 08:26 PM
Outlook folder issue - 2nd attempt Tim Anderson Microsoft Outlook Discussion 1 17th Jun 2006 02:42 PM
Security Issue on password attempt Paul Proefrock Windows XP Networking 5 27th May 2006 01:29 AM
IE Error Problems (3rd attempt at resolving issue) Brian Windows XP Internet Explorer 1 24th Aug 2004 07:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:53 AM.