How to allow information to be pasted on the next empty cell

whcmelvin

Board Regular
Joined
Jul 27, 2011
Messages
82
I am trying to print information on the next empty cell

This is my code

Code:
Dim r1 As Range
Dim n1 As Long
Dim NextRow1 As Long       
Application.ScreenUpdating = False

Sheets("Sheet1").Select

NextRow1 = Application.WorksheetFunction.CountA(Range("A:A")) + 1
Set r1 = Range(Cells(2, 1), Cells(NextRow1, 1))
    
    For n1 = 2 To r1.Rows.Count
            If Cells(n1, 12).Value = "" Then
                Cells(n1, 12).Value = "Hi"
            End If
    Next n1

However at Cells(n1,1) there is there are other things printed there.

Below is an image of my excel. i want the code above to print on L2, L3 and so on when there is an empty cell and regardless whether A1, A2 and so on is empty or filled.
imagepc.png
 

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.
Cells(Rows.Count, 12).End(xlUp).Offset(1).Value = "..."
 
Upvote 0
Hi I am in help badly to solve this. Please help. the code that wigi gave give me this result when i clicked it once.
image1hbz.jpg

i want it to print on one cell onli when i click it one time
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,881
Members
452,948
Latest member
Dupuhini

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