PDA

View Full Version : Need Help Duplicating dates in a column, with a VBA. Please



estatefinds
08-07-2016, 10:07 AM
Hello, I am trying to duplicate dates in a column B. I need this to be done in
VBA I am lost on this as the only thing I know of is deleted Duplicates or highlighting Duplicates. Also needs to run whenever data is in column AS LONG.

I am attaching a file of the dates in the in the column.

I dont have a macro for this as I am baffled.

Thank you very much in advance!!!:)

SamT
08-07-2016, 10:33 AM
Also needs to run whenever data is in column AS LONG.
If you mean AS LONG, like in VBA
Dim X As Long
There ain't no such thing in a cell.

estatefinds
08-07-2016, 10:42 AM
ok, no problem,
I meant when ever new dates gets entered I can run macro and it will placed duplicate below it thank you:)

so i t will run macro in current data and dupilcate it then when i add new date
I will run macro and it will duplicate the one just added and so.

like the visual in example.
Any help on this would be greatly appreciated. :)

estatefinds
08-08-2016, 05:02 AM
I found this code "Sub CopyData()
'Update 20140724
Dim Rng As Range
Dim InputRng As Range, OutRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
Set OutRng = OutRng.Range("A1")
For Each Rng In InputRng.Rows
xValue = Rng.Range("A1").Value
xNum = Rng.Range("B1").Value
OutRng.Resize(xNum, 1).Value = xValue
Set OutRng = OutRng.Offset(xNum, 0)
Next
End Sub

"
This is what Exactly I needed, I figured I'd share it . I found this in www.extendoffice.com/documents/excel1897-excel -repeat-cell-value-x-times.

Thank you for your help! :)