Macro paste in nth empty cell of a specific column

roversam

New Member
Joined
Sep 10, 2011
Messages
14
I have some information that I want to paste in a cell.

But the cell I want to paste the information into is the nth empty cell of a specific column. Where n can be any whole number. I know the column reference but not the row reference.

I know that I have to use a loop, but don't know exactly what to do?
How do I get to the nth empty cell?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Further, I want to save that row reference (in VBA's version of a variable I guess?) because I want to enter more columns of data after I have determined which row the data has to go into.
 
Upvote 0
If your dataset isn't too large (say < 30,000 or so), maybe something like this?
Code:
Sub nthblank()
Dim n As Long, e, k As Long
n = 7
With Range("A:A")
    .Cells(Rows.Count).Font.Bold = True
For Each e In .SpecialCells(xlBlanks)
    k = k + 1
    If k = n Then
        e.Select
        Range("C1") = e.Address
        Exit For
    End If
Next e
    .Cells(Rows.Count).Font.Bold = false
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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