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

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.




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:

More free tutorials and resources available at:




Tidak ada komentar:

Posting Komentar