ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do Until VB Macro (https://www.excelbanter.com/excel-programming/304708-do-until-vbulletin-macro.html)

Jerry[_10_]

Do Until VB Macro
 
Greetings:

I am not sure how to get excel to perform this function. I would like
a macro to find the text value C in column C and autofill the letter C
in column A until it comes to the text value D in column C and
continue to autofill the letter D in column A. Any help would be
greatly appreciated. Thank you in advance.

Jerry

Bernie Deitrick

Do Until VB Macro
 
Jerry,

You could do something like:

Sub TryNow()
Dim myCell As Range
Dim FoundC As Boolean
Dim FoundD As Boolean

FoundC = False
FoundD = False

For Each myCell In Intersect(Range("C:C"), ActiveSheet.UsedRange)
If FoundC Or myCell.Value = "C" Then
FoundC = True
Cells(myCell.Row, 1).Value = "C"
End If
If FoundD Or myCell.Value = "D" Then
FoundC = False
FoundD = True
Cells(myCell.Row, 1).Value = "D"
End If
Next myCell
End Sub

HTH,
Bernie
MS Excel MVP

"Jerry" wrote in message
om...
Greetings:

I am not sure how to get excel to perform this function. I would like
a macro to find the text value C in column C and autofill the letter C
in column A until it comes to the text value D in column C and
continue to autofill the letter D in column A. Any help would be
greatly appreciated. Thank you in advance.

Jerry





All times are GMT +1. The time now is 02:53 AM.

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