View Single Post
  #4   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 Jacob from Steved

I'm getting a Compile error "Variable Not Defined"

your script is highlighting "lngLastRow ="


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

I'm very sorry this is beyond my understanding as to what is happening and I
thank you for taking timeout on my issue.




"Jacob Skaria" wrote:

In D1 use a formula and copy that down
=TEXT(C1,"hhmm")

OR

Sub Mac()
lngLastRow = ActiveSheet.Cells(Rows.Count, "C").End(xlUp).Row
For lngRow = 1 To lngLastRow
Range("D" & lngRow) = Format(Range("c" & lngRow), "hhmm")
Next
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"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