View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Issue with a macro

sdate & ddate are not defined as variables.
maybe that's your problem.
:)
susan


On Sep 9, 2:52*pm, juancarlos wrote:
I’m using the below macro to copy a group of cells to another sheet, but I’m
getting an error message.

Can someone help me figure out what is wrong with the macro?

The idea is to copy the cell from text 180000 to 18:00:00 time

Dim bcell As Range '
Dim hh As String
Dim mm As String
Dim ss As String
r = 3
* *For Each bcell In Range("f51:f" & Trim(Str(20 + irows)))
* * hh = Mid(bcell, 1, 2)
* * mm = Mid(bcell, 3, 2)
* * ss = Mid(bcell, 5, 2)
* * sdate = hh & ":" & mm & ":" & ss
* * ddate = CDate(sdate)
* * Sheets("Sheet3").Cells(r, 5).Value = Format(ddate, "hh:mm:ss")
* * r = r + 1
* *Next bcell

--
Juan Carlos