ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to create sequence of numbers (https://www.excelbanter.com/excel-programming/406500-macro-create-sequence-numbers.html)

[email protected]

Macro to create sequence of numbers
 
Hi

I need a macro to count down column A until I reach 'Finish',
then I want to select cells E1:E'Finish' and autofill to F1:F'Finish'

Any ideas??

Barb Reinhardt

Macro to create sequence of numbers
 
This isn't as clean as I'd like it to be, but it'll do what you want

Sub Macro1()
'
Dim myRange As Range

Set myRange = Nothing
On Error Resume Next
Set myRange = Columns("A:A").Find(What:="Finish", _
After:=Cells(1, 1), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
On Error GoTo 0
If Not myRange Is Nothing Then
Range("F1:F" & myRange.Row).FillRight
Else
MsgBox ("Finish Not Found")
End If

End Sub

--
HTH,
Barb Reinhardt



" wrote:

Hi

I need a macro to count down column A until I reach 'Finish',
then I want to select cells E1:E'Finish' and autofill to F1:F'Finish'

Any ideas??



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com