Avatar of Sonia Bowditch
Sonia Bowditch
Flag for Guernsey asked on

Copy Data to Another Cell Based on Criteria

Dear Experts,

I have a .CSV file emailed to me each morning which I import into a Excel spreadsheet for analysis.  Since the application creating the file has been upgraded the formatting of the file has gone a bit wobbly.

For the some rows, data has blank cells between it and the next set of data.

I am trying to write a macro which look at the data and cut and paste data to another cell if it encounters a blank cell.  Once this criteria is no longer met, end the macro run.

Very (very) basic if statement I had written as a test to get all of the data into columns A:E:

If Range("C11") = "" Then
   Range("E11").Select
   Selection.Cut
   Range("C11").Select
   ActiveSheet.Paste

Else
MsgBox "Not blank"

End If

Attached is an example of formatting I am struggling with.

Any help you could give me would be greatly appreciated.

Regards,
Infosec36
raw_data.xlsx
Microsoft ExcelMicrosoft OfficeVB Script

Avatar of undefined
Last Comment
Subodh Tiwari (Neeraj)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Subodh Tiwari (Neeraj)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Sonia Bowditch

ASKER
Perfect.  Thank you.
Subodh Tiwari (Neeraj)

You're welcome. Glad I could help.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck