Find first empty cell in row range-VBA

ljubo_gr

Active Member
Joined
Dec 6, 2014
Messages
251
Office Version
  1. 2013
Platform
  1. Windows
=Happy+New(Year(2017))

I have three sheets, they have columns A&B, ranges A2:A100, B2:B100. "A" range will always be shorter than B, if that means something. I need vba code to move my selector to First free cell in sheet1 "A"range, another code for "B"range, then another codes for Sheet2...Sheet3.
Thanks in advance kind people!
 
Last edited:
THANK YOU ALL! I'll stay with Michael M.
Is this(A7: ) range starts looking from A7 to down? Right?

It would actually be searching from the bottom of the sheet, up to the first used cell it finds.
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Thanks, but i'll use arrows(or some kind of objects) above columns. So it will work on all ranges, all sheets? At A78 there is =sum... so i hope it will find first empty cell between A7:77! THANK YOU ALL! GOD BLESS JOHN LENNOX, LAWRENCE KRAUSS, RICHARD DAWKINS, WILLIAM LANE CRAIG, MICHIO KAKU...
 
Upvote 0
Bit shorter and it won't matter if the user inputs "a" or "A" in the inputbox
Option Compare Text
Code:
Option Compare Text
Sub upArrow()
ans = InputBox("Which Column Do you want to search, A or G ?")
Select Case ans
Case Is = "A"
ThisWorkbook.ActiveSheet.Range("A7:A" & Cells(Rows.Count, "A").End(xlUp).Row).Find(What:="", lookat:=xlWhole).Select
Case Is = "G"
ThisWorkbook.ActiveSheet.Range("G7:G" & Cells(Rows.Count, "G").End(xlUp).Row).Find(What:="", lookat:=xlWhole).Select
End Select
End Sub
 
Last edited:
Upvote 0
The codes start at A7 or G7 and work down for the first blank cell !!
 
Upvote 0
NO NO not working i'm novice, ERROR 400

this is in ThisWorkbook:
Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    If ActiveCell.Column() > 21 Or ActiveCell.Row() > 721 Or ActiveCell.Row() = 1 Then
        GoTo AkoGRESKA
        Else
        Application.ScreenUpdating = True
AkoGRESKA:
    End If
End Sub
 

Sub upArrow()
Dim foundBlank As Range
Set foundBlank = Range("b7:b").Find(What:="", lookat:=xlWhole)
    foundBlank.Select
End Sub
Sub DownArrow()
Dim foundBlank As Range
Set foundBlank = Range("p7:p").Find(What:="", lookat:=xlWhole)
    foundBlank.Select
End Sub
Help!
 
Upvote 0
What line is highlighted yellow on this error? I can see right now you have your "End If" located after your Goto thing... but what is even the point of this goto? And really what's the point of your sheetselectionchange event?
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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