macro help

P

puiuluipui

Hi, i need a macro to look in column B for a date ( 12/01 ) and then to add
the date to column A till last filled cell in A.

EX: (this is now)

A B
12/01
1 07:53:20
2 07:53:21
3 07:53:22
4 08:01:21
5 08:01:31
6 08:01:32
12/02
8 08:01:36
9 08:01:38
10 08:14:04
11 08:14:09

Ex: (after macro)
12/01
01.12.2009 07:53:20
01.12.2009 07:53:21
01.12.2009 07:53:22
01.12.2009 08:01:21
01.12.2009 08:01:31
01.12.2009 08:01:32
12/02
02.12.2009 08:01:36
02.12.2009 08:01:38
02.12.2009 08:14:04
02.12.2009 08:14:09
If in column A is a blank cell, in next cell in column B is a date.
Can this be done?
Thanks!
 
J

Jacob Skaria

Try the below

Sub Macro()
Dim lngRow As Long, varDate As Variant
For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Range("A" & lngRow) = "" Then
varDate = Range("B" & lngRow)
Else
Range("A" & lngRow) = varDate
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top