Find first blank cell in column K, on short term sheet

Chris_010101

Board Regular
Joined
Jul 24, 2017
Messages
186
Office Version
  1. 365
Platform
  1. Windows
Hello,

A simple one.

VBA Code:
Private Sub Workbook_Open()

    Dim wsCSP As Worksheet
    Set wsCSP = Sheets("CSP Tracking")
    
    Application.ScreenUpdating = False
    
        With wsCSP.[A1].CurrentRegion
                .AutoFilter 10, "<" & [Today()]
                .Offset(1).Resize(Rows.Count - 1).EntireRow.Delete
                .AutoFilter
        End With
        
        Worksheets("CSP Tracking").Range("L1").AutoFilter
                
    Application.ScreenUpdating = True
    
End Sub

The above code executes when excel is opened. When this is finished working, I need it to go to the "Short Term" sheet, look at column K and select the first available blank cell it finds.

I've tried to add this myself, but I can only get it to open the "Short Term" sheet on whatever cell was last selected on that sheet.

Kind Regards
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Try this:

VBA Code:
Private Sub Workbook_Open()
  Dim wsCSP As Worksheet
  
  Set wsCSP = Sheets("CSP Tracking")
  Application.ScreenUpdating = False
  With wsCSP.[A1].CurrentRegion
    .AutoFilter 10, "<" & [Today()]
    .Offset(1).Resize(Rows.Count - 1).EntireRow.Delete
  End With
  Worksheets("CSP Tracking").Range("L1").AutoFilter
  
  Sheets("Short Term").Select
  Range("K1:K" & Range("K" & Rows.Count).End(3).Row + 1).Find("", Range("K1"), xlValues, xlWhole).Select
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Try this:

VBA Code:
Private Sub Workbook_Open()
  Dim wsCSP As Worksheet
 
  Set wsCSP = Sheets("CSP Tracking")
  Application.ScreenUpdating = False
  With wsCSP.[A1].CurrentRegion
    .AutoFilter 10, "<" & [Today()]
    .Offset(1).Resize(Rows.Count - 1).EntireRow.Delete
  End With
  Worksheets("CSP Tracking").Range("L1").AutoFilter
 
  Sheets("Short Term").Select
  Range("K1:K" & Range("K" & Rows.Count).End(3).Row + 1).Find("", Range("K1"), xlValues, xlWhole).Select
  Application.ScreenUpdating = True
End Sub
Yes, this works.

Thanks very much :)
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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