Look for blank cells on a non active sheet?

danbates

Active Member
Joined
Oct 8, 2017
Messages
377
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Please can someone help me?

I have this code that works fine for me when the Daily Check Sheet is active.
I now need it altering so the code still looks for the same blanks cells on the Daily Check Sheet but when the sheet isn't active.

Here is my code:

Code:
Sub DaysandMonthsandInitials()

ThisWorkbook.Sheets("Daily Check Sheet").Activate


ActiveCell.Offset(0, 1).Select


D = WorksheetFunction.CountBlank(ActiveCell.Resize(14))
M = WorksheetFunction.CountBlank(ActiveCell.Offset(16))


'MsgBox D & ", " & M


If D > 0 And M > 0 Then


DaysandMonths


ElseIf D = 0 And M > 0 Then


Months


ElseIf D > 0 And M = 0 Then


Days


End If
End Sub

Any help would be appreciated.

Thanks

Dan
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
You cannot select a cell on a sheet unless it is the active sheet. Is the active cell on "Daily Check Sheet" always the same and if so, what is it?
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,108
Members
452,544
Latest member
aush

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