PC Review


Reply
Thread Tools Rate Thread

Can't get the macro to continue through a range

 
 
Carrie_Loos via OfficeKB.com
Guest
Posts: n/a
 
      23rd Jan 2008
I am having trouble with getting this to pass through the range of
"DataWithOnes". Not sure how to do this, can anyone see why?

Thx in advance



Sub Data_With_Ones()

Set DataWithOnes = Range("E3:AU200")
For Each c In DataWithOnes

If c.Value > 0 Then


Cells.Find(What:="1", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:
= _
False, SearchFormat:=False).Activate
Set topcell = ActiveCell

Cells.Find(What:="2", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:
= _
False, SearchFormat:=False).Activate
Set bottomcell = ActiveCell

If topcell = 1 Then Set topcell = topcell

Range(topcell, bottomcell).Select
Selection.FillDown
bottomcell.Select

Else:
End If

Next


End Sub

--
Message posted via http://www.officekb.com

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      23rd Jan 2008
Trouble in what way? It errors, doesn't do what you want?

What is it supposed to be doing?

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Carrie_Loos via OfficeKB.com" <u34134@uwe> wrote in message
news:7ea8eeff31091@uwe...
>I am having trouble with getting this to pass through the range of
> "DataWithOnes". Not sure how to do this, can anyone see why?
>
> Thx in advance
>
>
>
> Sub Data_With_Ones()
>
> Set DataWithOnes = Range("E3:AU200")
> For Each c In DataWithOnes
>
> If c.Value > 0 Then
>
>
> Cells.Find(What:="1", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
> xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
> MatchCase:
> = _
> False, SearchFormat:=False).Activate
> Set topcell = ActiveCell
>
> Cells.Find(What:="2", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
> xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
> MatchCase:
> = _
> False, SearchFormat:=False).Activate
> Set bottomcell = ActiveCell
>
> If topcell = 1 Then Set topcell = topcell
>
> Range(topcell, bottomcell).Select
> Selection.FillDown
> bottomcell.Select
>
> Else:
> End If
>
> Next
>
>
> End Sub
>
> --
> Message posted via http://www.officekb.com
>



 
Reply With Quote
 
Carrie_Loos via OfficeKB.com
Guest
Posts: n/a
 
      24th Jan 2008
It performs the macro outside of the range, I want to keep the macro in a
specific area and not find 1's and 2's in other parts of the worksheet.

Bob Phillips wrote:
>Trouble in what way? It errors, doesn't do what you want?
>
>What is it supposed to be doing?
>
>>I am having trouble with getting this to pass through the range of
>> "DataWithOnes". Not sure how to do this, can anyone see why?

>[quoted text clipped - 34 lines]
>>
>> End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200801/1

 
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
How do I continue a macro? =?Utf-8?B?RUJI?= Microsoft Word Document Management 0 19th Oct 2007 01:11 AM
macro to scroll the worksheet and continue to run macro in backgro =?Utf-8?B?TWljYWg=?= Microsoft Excel Programming 2 1st Oct 2007 05:10 PM
How to continue macro if there is an error value =?Utf-8?B?bXNkcm9sZg==?= Microsoft Excel Programming 1 2nd Nov 2006 07:23 PM
open workbook from a macro and continue this macro afterwards =?Utf-8?B?Q2hyaXMgRGUgTHV5Y2s=?= Microsoft Excel Programming 3 19th Dec 2005 12:12 PM
VBA codes for macro to continue Brian Microsoft Excel Programming 11 23rd May 2005 11:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:35 AM.