Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I need to find 4 cells in the same column that have the same value, 4. I need to save the row so I can use it as the end of my print range. Here is what I have so far but it's not working. Can anyone help? Sub PrintDoc() Dim LastRow As Integer 'Last Row of Printing Range Dim FirstAddress As Range 'First found occurance of a match Dim NextAddress As Range ' Next occurance of a match Dim X As Integer 'counter X = 0 'set counter to 0 With ActiveSheet.Range("E36:E336") Set c = .Find(0, LookIn:=xlValues) If Not c Is Nothing Then FirstAddress = c.Address Do NextAddress = c.Address If NextAddress = FirstAddress + 1 Then ' are the matches continuous? X = X + 1 'increment the counter LastRow = NextAddress - 4 'save the row location Set c = .FindNext(c) End If Loop While Not c Is Nothing And X < 4 End If End With Range("E1:" & "O" & LastRow).Select Selection.PrintOut Copies:=1, Collate:=True End Sub Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
A GROUP OF CONTINUOUS CELLS ARE KNOWN AS | Excel Discussion (Misc queries) | |||
Count Continuous data between cells | Excel Worksheet Functions | |||
Continuous hughlighting of cells | Excel Discussion (Misc queries) | |||
COUNTIF With Non-Continuous Cells | Excel Worksheet Functions | |||
Updating Sheets on a non continuous cells | Excel Programming |