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

Leksv0j

New Member
Joined
Sep 15, 2017
Messages
22
[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl65, width: 64"]Hi[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]Would someone be able to help with the VBA code if cell does not contain "data" the go to next code?[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]Eg: skip cell does not contain "Asset" the go to next code cell contains "Same"?[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl65"]I have the below code which I use to generate cell range contains "asset"[/TD]
[/TR]
[TR]
[TD]ActiveSheet.Range("$A$1:$AA$76").AutoFilter Field:=22, Criteria1:= _"=*Asset*", Operator:=xlAnd[/TD]
[/TR]
[TR]
[TD]''''' do stuff'''''''''''[/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"]i want the code above to if not found go to next code[/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"]Sub within_PO()[/TD]
[/TR]
[TR]
[TD="class: xl66, width: 64"][/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"][/TD]
[/TR]
[TR]
[TD="class: xl66, width: 64"]ActiveSheet.Range("$A$1:$AA$76").AutoFilter Field:=22, Criteria1:= _"=*Same*", Operator:=xlAnd[/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"][/TD]
[/TR]
[TR]
[TD]Thank you so much[/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"][/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"][/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"][/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"][/TD]
[/TR]
[TR]
[TD="class: xl68"][/TD]
[/TR]
[TR]
[TD="class: xl67, width: 64"][/TD]
[/TR]
[TR]
[TD="class: xl65"][/TD]
[/TR]
</tbody>[/TABLE]
 
Glad to help & thanks for the feedback

[TABLE="width: 576"]
<colgroup><col span="9"></colgroup><tbody>[TR]
[TD="colspan: 2"]hi there Fluff[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 9"]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.[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

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.

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,022
Latest member
RobertV1609

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