select first blank cell in row -insert value and loop to next row

daz457

New Member
Joined
Sep 21, 2020
Messages
16
Office Version
  1. 2016
Platform
  1. Windows
I have a table of data approx 25 columns and roughly 100 rows.
Each row has data but also blank cells(see image)
What I would like to be able to do is run a code that looks at each row in turn.
It would find the first empty cell in that row
Insert "1" into this cell , disregard any other cells on this row and then go to the row below and do the same.
Loop until it does not find any more rows to look at.

I have trawled lots of code, I can find the first empty cell in a given row and then manually insert a value, but cannot loop down to the next row, very new to VBA, I usually record macros and tweak as required, recording and adding bits of code as I go.

I am sure this is not too difficult but a bit beyond me

Thanks in advance
 

Attachments

  • Capture.JPG
    Capture.JPG
    108.2 KB · Views: 9

daz457

New Member
Joined
Sep 21, 2020
Messages
16
Office Version
  1. 2016
Platform
  1. Windows
I rolled out the finished spreadsheet to my colleague today, we export a report from a SAP database and have been manually sorting, deleting rows columns etc. Usually a hundred or so rows which all need the first empty cells highlighting and a "1" adding to it. This has made a big difference to what was a bit of a tiresome chore.
Once again thank you both for your input and advice.
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Watch MrExcel Video

Forum statistics

Threads
1,118,599
Messages
5,573,136
Members
412,506
Latest member
StaffanExcel
Top