0
votes

I am looking for a simple VBA to advance through the sheets in a workbook to find the first sheet where a specific cell location is blank. Example, I have workbook with dated tabs for the whole year, and in cell E1 I fill in the days date. Today I want to copy data from another export file, then in my dated file loop through the sheets until it finds the first sheet where cell E1 would be blank, then do my copy paste function to. During the copy paste function I will paste the date into cell E1 so when to looks the next day it will by-pass that sheet. Any ideas would be helpful.

1
For each worksheet in workbook.worksheetsxQbert

1 Answers

2
votes

Give this a try:

Sub BlankFinder()
    For Each sh In Sheets
        If sh.Range("E1") = "" Then
            MsgBox "E1 found blank in sheet " & sh.Name
            Exit Sub
        End If
    Next sh
End Sub