Forum Discussion

himanshujoshi2211's avatar
himanshujoshi2211
Copper Contributor
Nov 09, 2024

adjust my data

i have mix data with dates and stock names but i want to adjust my data like what i show in picture. and i have huge amount of data. i just want to adjust my data date wise.

4 Replies

  • you can see this,from A17 date is same ok but after A17 date is change. so i have huge data and many dates like this so want complite row blank beetwen every date change. and how change i want that is i also i show in previews scrennshot. and ignore my spellings mistakes.

  • Sub adjust()

    Dim i As Long, j As Long

    i = Range("A" & Rows.Count).End(xlUp).Row

    For j = i To 2 Step -1

    If Cells(j, 1).Value = Cells(j - 1, 1).Value Then
    Else
    Rows(j).Insert

    End If

    Next j

    End Sub

     

    You can run this macro which should return the intended result. The assumption is that the data is sorted by the dates in column A before running the macro.

  • FatManFluff's avatar
    FatManFluff
    Brass Contributor

    Not sure if I understand your question exactly but I think your saying that you want to format your date to be in the format you're showing on the screenshot if so:

    1. Hightlight all cells that contain that dates
    2. Right click --> format cells (or CTRL+1)
    3. In numbers tab clcik on Custom on the left
    4. Set your type to DD-MM-YYYY
    5. Hit ok

    Hope this is what you mean 👍

Resources