Conditional Formatting help...

  • Thread starter Thread starter mjack003
  • Start date Start date
M

mjack003

Hi,

I need to create a macro which will put the current date in column
for any row which contains text in Column A from A17 to A500, in al
grouped worksheets. The date should only change when the macro i
activated. Thanks in advance.

Best Regards,
Mjac
 
Untested:

Dim ws As Worksheet, c As Range
For Each ws In ActiveWindow.SelectedSheets
For Each c In ws.Range("A17:A500")
If c <> "" Then c.Offset(, 5) = Date
Next
Next
 
You lost me on the Grouped part. I looped through sheets 1-3 instead.

Sub DateIt()
Dim rng1 As Range, r As Range
Dim sDate As Date
Dim x As Integer
Dim ws As Worksheet

sDate = Date

For x = 1 To 3
Set ws = Worksheets(x)
Set rng1 = ws.Range("A17:A500")

For Each r In rng1.Cells
sType = TypeName(r.Value)
If sType = "String" Then
r.Offset(0, 5).Value = sDate
End If
Next
Next

End Sub

HTH,
Yo.
 
Hi,

Haven't been able to try either macro over the weekend but thank yo
for replying. Yo what I mean by "grouped" is all selected worksheets.
By holding ctrl+single click I select particular worksheets out of th
hundreds and need to enter the current date in those only. I also nee
the date to be a one time thing. In other words I don't want it t
update, only when the command button is clicked. Thanks again.

Regards,
Mjac
 
Thanks, for the explanation... I actually realized what you meant after I
read Vasant's post; which should work just fine. The date will not change.
 
Thank you for the help. It works perfectly. I know this should b
simple but how would I have the macro also change the date to re
text?
Thanks again.

Best Regards,
Mjac
 
Back
Top