Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50099

Check if the cell format is date and change it to date Format(cell.Value, "yyyy/mm/dd")

$
0
0
hi all,

i would like to check a range of cell whether is date format or not, and if yes, change it to format(cell.Value, "yyyy/mm/dd")

Code:


Sheets(1).Select
 last_row = ActiveSheet.UsedRange.Rows.Count
For Each cell In Range("G1:H" & LastRow)
 

'how to write this part

if the cell format is date then
cell = Format(cell.Value, "yyyy/mm/dd")
end if

 Next


please help.

thank you.

Viewing all articles
Browse latest Browse all 50099

Trending Articles