Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Some nice person out there gave me the code " If c.Address = "R65535C47" Then
Exit For End If" to end my macro but I just can't seem to get it to work. When I test the macro everything runs fine, the highlight ends up at location R65535C47. [This cell has a 1 in it] But it doesn't recognize the cell reference and skips to the End IF. I have tried several different approaches but nothing seems to work......Any Ideas? (The macro is for class dates, it designates 1's for start dates and 2's for end class dates then loops through an entire worksheet finds 1's and 2's and fills in the cells inbetween with 1's) Sub FindOnes() Dim r As Range Dim Topcell As Variant Dim Bottomcell As Variant Set r = ActiveSheet.Range("E3:AU65534") Range("E3").Select For Each c In r Cells.Find(What:="1", After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase: = _ False, SearchFormat:=True).Activate If ActiveCell.Value = 1 Then Set Topcell = ActiveCell If c.Address = "R65535C47" Then Exit For End If Cells.Find(What:="2", After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase: = _ False, SearchFormat:=True).Activate If ActiveCell.Value = 2 Then Set Bottomcell = ActiveCell If Topcell = 1 Then Set Topcell = Topcell Range(Topcell, Bottomcell).Select Selection.FillDown Bottomcell.Select End If End If Next End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200801/1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I stop scrolling from column to column ? | Excel Worksheet Functions | |||
Stop the macro at the end of a certain column | Excel Programming | |||
how do I set my tab to stop at column N and rtn to A | Excel Discussion (Misc queries) | |||
Macro: With Stop it works. Without Stop it doesn't. | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |