Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,641
- Office Version
- 365
- 2016
- Platform
- Windows
With the code snippet below, I am referencing a filtered worksheet. I am trying to select the first empty cell in column J of this filtered worksheet. The line in red below nets me an error ("Application-defined or object-defined error") with the line is red.
In my testing, the first empty cell in column J of filtered worksheet "ws_ifm" is 37. J37 is the cell that should be selected (ie have the bounding box around it). When I debug ?cell.address(fvc) I get $J:$J.
In my testing, the first empty cell in column J of filtered worksheet "ws_ifm" is 37. J37 is the cell that should be selected (ie have the bounding box around it). When I debug ?cell.address(fvc) I get $J:$J.
Rich (BB code):
Dim mccnt As Long
Dim response
Dim ws_ifm as Worksheet
Dim ifmrng as Range
Dim cell as Range
Dim fvc as Range
Set ws_ifm = wb_catalogue.worksheets("IFM (M)")
With Worksheets("Dump")
.Rows(2).EntireRow.Delete
mccnt = WorksheetFunction.Count(.Columns("J")) 'check how many titles have been model checked
If mccnt = 0 Then 'model has not been checked yet
response = MsgBox(txt_model & " has not been model checked." & Chr(13) & "Proceed with model check?", vbYesNo, "Model Check Failed")
If response = vbNo Then Exit Sub
With ws_ifm 'select first empty cell in column J
Set ifmrng = .Columns(10)
For Each cell In ifmrng
If cell.EntireRow.Hidden = False Then
Set fvc = cell
Exit For
End If
Next cell
If Not fvc Is Nothing Then
.range(fvc).Select
Else
MsgBox "Error: No visible cells found in filtered range.", , "Error"
End If
End With
...