Rabu, 13 April 2016

Re: [ExcelVBA] select range

 

Dear Torstein
It's Range not .Cells

 Sub Torstein()
 Dim rader As Long, kolonner As Long
    With Range("test")
        rader = .Rows.Count
        kolonner = .Columns.Count
        Range(.Cells(1, 3), .Cells(rader, kolonner)).Select
    End With
 End Sub

Regards
Derek Turner 
England +++



From: "Torstein Johnsen sejohnse@yahoo.no [ExcelVBA]" <ExcelVBA@yahoogroups.com>
To: yahoogroups <excelvba@yahoogroups.com>
Sent: Wednesday, 13 April 2016, 8:08
Subject: [ExcelVBA] select range

 
I want to Select a range based on a named range "test"  (that may change).

My New selected range are to consist of the named range, but not the first two columns.

This is my try:

Sub test2()
rader = Range("test").Rows.Count
kolonner = Range("test").Columns.Count

With Range("test")
    .Cells(.Cells(1, 3), .Cells(rader, kolonner)).Select
End With

The result is one cell selected - the one that is one up and one left from the range's upper left corner.

Regards

Torstein


__._,_.___

Posted by: Derek Turner <g4swy@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Poskan Komentar