View Single Post
 
Old 03-28-2016, 08:45 PM
Philb1 Philb1 is offline Windows 10 Office 2010 32bit
Advanced Beginner
 
Join Date: Feb 2016
Location: Auckland
Posts: 43
Philb1 is on a distinguished road
Default

Hi Rod
With the example you gave the code below will change any cell with a date in the range on column I to 4/5
Using Replace will work for a range of cells with the same date, if there are different dates you will still have to loop through the dates.
This is a start, if you want more help can you provide more detail & a better example etc
Code:
Option Explicit

Sub ReplaceDates()

Dim Ws As Worksheet
Dim Rcell As Range
Dim sReplaceWith As String
sReplaceWith = "4/5"

Set Ws = ThisWorkbook.ActiveSheet

For Each Rcell In Ws.Range(Ws.Cells(19, 9), Ws.Cells(Rows.Count, 9).End(xlUp))
    If IsDate(Rcell) Then
        With Rcell
            .NumberFormat = "@"
            .Value = sReplaceWith
        End With
    End If
Next Rcell

End Sub
Reply With Quote