I've been sitting with this problem for a few hours and would be very thankful if anyone here could assist me.
What I want to do:
- For all cells A10:A180 in sheet1
- If cell contains a date on the form YYYY-MM-DD
- Copy cell and the two next cells to the right (e.g. A11:A13)
- Remove all formatting, so as to only copy the value/string of the cell.
- Paste at end of column in sheet2
- When finished, sort the entries (whole row) by date
Any thoughts?
Best regards Dean
Edit: copy&pasted code from comments:
Private Sub Worksheet_Activate()
Sheet2.Cells.Clear
Dim R1 As Range, R2 As Range
Dim wsFrom As Worksheet, wsTo As Worksheet
Set wsFrom = ThisWorkbook.Sheets("Blad1")
Set wsTo = ThisWorkbook.Sheets("Blad2")
Set R1 = wsFrom.Range("A:B")
Set R2 = wsTo.Range("A:B")
R1.Copy R2
End Sub
42005
, the value formatted as a date2015-01-01
or to convert it to a string"2015-01-01"
and change the number format in output range astext
? – AprillionPrivate Sub Worksheet_Activate() Sheet2.Cells.Clear Dim R1 As Range, R2 As Range Dim wsFrom As Worksheet, wsTo As Worksheet Set wsFrom = ThisWorkbook.Sheets("Blad1") Set wsTo = ThisWorkbook.Sheets("Blad2") Set R1 = wsFrom.Range("A:B") Set R2 = wsTo.Range("A:B") R1.Copy R2 End Sub
– deanA11:A13
do you meanA10:C10
? – Aprillionend of column in sheet2
please? value from cell A10 should be pasted where for example? – Aprillion