Error assigning a range

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
EDIT ... Disregard, brain back from lunch and problem identified and resolved.

Rich (BB code):
    Dim amr_range As Range
    Dim pmr_range As Range
    Dim rw_ar_start As Integer
    Dim rw_ar_end As Integer
    Dim rw_pr_start As Integer
    Dim rw_pr_end As Integer
    Dim temp_ws As Worksheet
    Dim ar, pr As Integer
    
    Set temp_ws = Workbooks("schedule.csv").Worksheets("temp_ws")
    l_temp_lrow = temp_ws.Cells(temp_ws.Rows.count, "M").End(xlUp).row
    ar = WorksheetFunction.CountIf(temp_ws.Range("L:L"), "act")       
    pr = WorksheetFunction.CountIf(temp_ws.Range("L:L"), "pass")
    
    'active range
    rw_ar_start = WorksheetFunction.Match("act", temp_ws.Range("L1:L" & l_temp_lrow), 0)   'row number of the first "act"
    rw_ar_end = rw_ar_start - 1 + ar
    set amr_range = temp_ws.Range(temp_ws.Cells(rw_ar_start, 13), temp_ws.Cells(rw_ar_end, 16))

I am receiving an error with the line in red.
"Object variable or With Block variable not set."

ar = 28
rw_ar_start = 1
rw_ar_end = 28

I am imagining this to be an oversight on my part, but I hope someone is able to point it out for me.
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,223,275
Messages
6,171,123
Members
452,381
Latest member
Nova88

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