activecell offset help

aspence

Board Regular
Joined
Feb 10, 2009
Messages
130
I have the code below, which defines a range in column K then searches that range for any cell where the value equals "Customer Tickets". From there, I am having trouble getting what I want out of the macro.

What I need is:
For every occurance of "Customer Tickets" in column K, i need some of the data in the corresponding rows to be changed to "Checked".

For example, if the macro finds cell K19 to be equal to "Customer Tickets, then I need the value in cells M19:O19 to all equal "Checked" and I cant seem to get the offset to work correctly.

Code:
Sub CustTick()
 
Dim metric As Range
' highlights variable range in column K
LastRow = Range("K1").End(xlDown).Row
Range(Cells(2, "K"), Cells(LastRow, "K")).Select
' sets selection as the range to search
Set metric = Selection
For Each Cell In metric
  If Cell = "Customer Tickets" Then
    ' need macro
  End If
Next Cell
End Sub

Any ideas?
 
Code:
Sub test()
Dim c As Long, d As Range, e As Long
c = Range("K" & Rows.Count).End(xlUp).Row
For Each d In Range("K1:K" & c)
    If UCase(d) = "CUSTOMER TICKETS" Then
        For e = 2 To 4
            If d.Offset(, e) > d.Offset(, 1) Then
                d.Offset(, e).Interior.Color = vbRed
            Else
                d.Offset(, e).Interior.ColorIndex = xlNone
            End If
        Next
    End If
Next
End Sub
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
And to increase the number of columns, I just increase the last number here.
Code:
For e = 2 To 4
For example, to include column P, Q and R.
Code:
For e = 2 To 7

The help is much appreciated HOTPEPPER. I should be good to work this to my exact specifications.
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,451
Members
452,915
Latest member
hannnahheileen

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