Searching a range for IsEmpty()

Ritzyy

New Member
Joined
Jan 28, 2013
Messages
29
Hi,

I'm trying to search a range to see if any cell contains a wild card End*

I'm not sure how to make this code work.


Dim cell As Range
Set WS3 = ThisWorkbook.Sheets("Sheet3")
Set WS5 = ThisWorkbook.Sheets("Sheet5")
Set WSH = ThisWorkbook.Sheets("Sheet6")


If IsEmpty(WSH.Cells(WS3.Range("A5") + 1, WS3.Range("C1") + 1)) Then
For Each cell In WS5.Cells(1, 2).Resize(WS3.Range("A5") - WS3.Range("A3"))
If cell Like "End*" Then
'stuff goes here
End If
Next cell
End If

Basically I'm trying to search a range defined by resize to see if any cells contain anything starting with End.

The reason I used resize instead of Range() is because the number of rows to be searched varies with the numbers in A5 and A3 of worksheet 3.

Thanks in advance, I'm relatively new to vba so it's probablly a simple mistake.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
like this?

Code:
Dim cell As Range
Set WS3 = ThisWorkbook.Sheets("Sheet3")
Set WS5 = ThisWorkbook.Sheets("Sheet5")
Set WSH = ThisWorkbook.Sheets("Sheet6")


If IsEmpty(WSH.Cells(WS3.Range("A5") + 1, WS3.Range("C1") + 1)) Then
For Each cell In WS5.Cells(1, 2).Resize(WS3.Range("A5") - WS3.Range("A3"))
If InStr(cell, "End*") = 1 Then
 'code here
End If
Next cell
End If
 
Upvote 0

Forum statistics

Threads
1,223,710
Messages
6,174,019
Members
452,542
Latest member
Bricklin

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