View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Steved Steved is offline
external usenet poster
 
Posts: 519
Default My attempt to do a Replace

Hello Joel from Steved

Joel your script is showing a Compile error "Variable not defined"

In your case it is highlighting "LastRow ="

Is this because 13:05 in the worksheet, is displayed as 1:05:00 p.m. in the
Formula Bar.

I thankyou for taking timeout on my issue.



"Joel" wrote:

Sub ReplaceColon()

Dim Rng As Range
LastRow = Range("C" & Rows.Count).End(xlUp).Row
Range("D2").Formula = "=text(C2,""HHMM"")"
Range("D2").Copy _
Destination:=Range("D2:D" & LastRow)

End Sub


"Steved" wrote:

Hello from Steved

Whats my Objective

simply replace Semi colon (":")

example 07:40 to 0740 or 13:05 to 1305

The information is in Column C:C and I've asking it to be put in Column D:D
please

Sub ReplaceColon()
For X = 1 To 1
Dim Rng As Range
Set Rng = Format(Range("C2"), "hhmm").End(xlUp)
Range("C2").Select
For Each cell In Rng
If cell.Value < "" Then
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=MID(RC[-1],1+(LEFT(RC[-1])=""0""),99)"
ActiveCell.Offset(1, -1).Select
End If
Next cell
Next X
End Sub

Thankyou




-----------------------------------------------------------------------------
Our Peering Groups change
Visit : http://spacesst.com/peerin