Find and Select first empty cell + add formula

ncc84330

New Member
Joined
Feb 6, 2023
Messages
3
Office Version
  1. 2007
Platform
  1. Windows
Hi All,

I stucked, i would appreciate if you could help me:
Part 1 oke, but i do not know how to continue:

1. Find and Select the First Blank Cell in Column A

2. The cell what was found by the code, has to get a formula, always refer to the cell one above it
If this cell is A14 than =+A13
If this cell is A5 than =+A4
..and so on

Sub Macro1()
Dim ws As Worksheet
Set ws = ActiveSheet
For Each cell In ws.Columns(1).Cells
If IsEmpty(cell) = True Then cell.Select: Exit For
Next cell
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi & welcome to MrExcel.
How about
Excel Formula:
If IsEmpty(cell) = True Then cell.Formula = "=r[-1]c": Exit For
 
Upvote 1
You are amazing :) This is working great
Just one more thing, sorry my knowledge is less than basic.

I just would like to select and copy this cell value
and i think i cand handle the rest with macro record
 
Upvote 0
Ok, how about
VBA Code:
If IsEmpty(cell) = True Then
   cell.Formula = "=r[-1]c"
   cell.Copy
   Exit For
End If
 
Upvote 0
Solution
Ok, how about
VBA Code:
If IsEmpty(cell) = True Then
   cell.Formula = "=r[-1]c"
   cell.Copy
   Exit For
End If
pretty close, but getting error message End without block if

Dim ws As Worksheet
Set ws = ActiveSheet
For Each cell In ws.Columns(1).Cells
If IsEmpty(cell) = True Then cell.Formula = "=r[-1]c"
cell.Copy
Exit For
End If
End Sub
 
Upvote 0
You have deleted this line Next cell you have also changed the code I posted. Hence the error.
 
Upvote 1

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top