.CELLS.END: what is this doing?

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,786
Office Version
  1. 2016
Platform
  1. Windows
In the below statement what is .Cells(65536,z).End(3)(2) saying?

.Cells(65536, z).End(3)(2) = Left$(ws.Name, Len(ws.Name) - 6)
.Hyperlinks.Add _
Anchor:=.Cells(65536, z).End(3), _
Address:="", _
SubAddress:="'" & ws.Name & "'!A1"
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi em,

Have a look in the VBE Help files at the End property and the Item property. This will add some meat to the bare bones explanation below:
Code:
Sub Test()
    Dim z As Integer
    
    z = 1
    With ThisWorkbook.Worksheets("Sheet1")
        MsgBox .Cells(65536, z).End(3)(2).Address
        'start from row 65536 in the column referenced by z
        
        'Use the third argument of the End property (ie Up) :
        '   xlToLeft, xlToRight, xlUp, or xlDown
        'to find the last cell containing data
        
        'the (2) represents the 2nd Item from the cell found above
        'the first item is the cell itself so the 2nd represents the
        'next cell down (ie the next blank cell)
        
    End With

End Sub
HTH
 
Upvote 0
Richie(UK) - thanks. I am studying the help files now...
 
Upvote 0

Forum statistics

Threads
1,203,107
Messages
6,053,557
Members
444,673
Latest member
Jagadeshrao

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