if cell does not contain value skip then go to next code

Leksv0j

New Member
Joined
Sep 15, 2017
Messages
22
Hi
Would someone be able to help with the VBA code if cell does not contain "data" the go to next code?
Eg: skip cell does not contain "Asset" the go to next code cell contains "Same"?
I have the below code which I use to generate cell range contains "asset"
ActiveSheet.Range("$A$1:$AA$76").AutoFilter Field:=22, Criteria1:= _"=*Asset*", Operator:=xlAnd
''''' do stuff'''''''''''
i want the code above to if not found go to next code
Sub within_PO()
ActiveSheet.Range("$A$1:$AA$76").AutoFilter Field:=22, Criteria1:= _"=*Same*", Operator:=xlAnd
Thank you so much

<tbody>
</tbody>
 
Glad to help & thanks for the feedback

hi there Fluff
in the previous code,im having problem with my offset code below if only 1 result is found.

Code:
[TABLE="width: 256"]
<colgroup><col span="4"></colgroup><tbody>[TR]
[TD="colspan: 3"]Range("AE1").Select[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 4"]    ActiveCell.Offset(1, 0).Select[/TD]
[/TR]
[TR]
[TD="colspan: 4"]    Do Until ActiveCell.EntireRow.Hidden = False[/TD]
[/TR]
[TR]
[TD="colspan: 4"]        ActiveCell.Offset(1, 0).Select[/TD]
[/TR]
[TR]
[TD]    Loop[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]    [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 3"]    ActiveCell.FormulaR1C1 = _[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 4"]        "=VLOOKUP(RC28,'[My FAR Search Engine.xlsx]ASSET # Search'!R4C2:R2000C10,COLUMNS(RC28:RC[-3]),0)"[/TD]
[/TR]
[TR]
[TD]        [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]    [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]    Selection.Copy[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]   [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 4"]    ActiveCell.Offset(0, -2).Select[/TD]
[/TR]
[TR]
[TD]    [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 4"]    Selection.End(xlDown).Select[/TD]
[/TR]
[TR]
[TD="colspan: 4"]    ActiveCell.Offset(0, 2).Range("A1:I1").Select[/TD]
[/TR]
[TR]
[TD="colspan: 4"]    Range(Selection, Selection.End(xlUp)).Select[/TD]
[/TR]
[TR]
[TD="colspan: 3"]    ActiveSheet.Paste[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

the code will still run to select til the end.i need only to copy the only result if only 1 asset is found.

<colgroup><col span="9"></colgroup><tbody>
</tbody>
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,215,045
Messages
6,122,830
Members
449,096
Latest member
Erald

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