working with ranges, using functions if and case

Naibei dennis

New Member
Joined
Apr 16, 2018
Messages
1
[TABLE="width: 500"]
<tbody>[TR]
[TD]sortcut[/TD]
[TD]for booking[/TD]
[TD]acount[/TD]
[TD]team[/TD]
[TD]ch[/TD]
[TD]pt[/TD]
[TD]yth m[/TD]
[TD]total[/TD]
[/TR]
[TR]
[TD] 001-cw[/TD]
[TD]we[/TD]
[TD]09998475[/TD]
[TD]44[/TD]
[TD]66[/TD]
[TD][/TD]
[TD][/TD]
[TD]110[/TD]
[/TR]
[TR]
[TD]003-dd[/TD]
[TD]rer[/TD]
[TD]55656[/TD]
[TD]38[/TD]
[TD]20[/TD]
[TD][/TD]
[TD]43[/TD]
[TD]101[/TD]
[/TR]
</tbody>[/TABLE]
wanted code that check if total >0 then check the rows team,ch,pt,and yth m onlly if its > 0, otherwise move next line.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
What do you mean when you say check the rows team,Ch,PT and Yth m ?


This will check if the total if greater then 0. You would need to add the code into the if statement to do what you want to do.
Code:
Sub checktotal()
Dim lr As Long
lr = Cells(Rows.Count, "H").End(xlUp).Row
For x = 2 To lr
    If Cells(x, "H") > 0 Then
        'what you want to do here
        Stop
    End If
Next x

End Sub
 
Upvote 0

Forum statistics

Threads
1,225,754
Messages
6,186,825
Members
453,377
Latest member
JoyousOne

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