Macro to create sequence of numbers

  • Thread starter Thread starter matrix_inevitable
  • Start date Start date
M

matrix_inevitable

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??
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top