ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   selecting data in a row (https://www.excelbanter.com/excel-worksheet-functions/255549-selecting-data-row.html)

darkblue

selecting data in a row
 
Dim rng As Range
With Worksheets("Data")
Set rng = .Range("a2", .Range("a" & Rows.count).End(xlUp))
End With
rng.Select
--------------------

With above code I select all data in column A.
How can I select all data in row 1.
I mean what is the equal code for selecting columns in a row ?
Thank you.


Per Jessen

selecting data in a row
 
HI

Look at this:

Dim Rng2 As Range
With Worksheets("Data")
Set rng = .Range("a2", .Range("a" & Columns.Count).End(xlToLeft))
End With

Regards,
Per


"darkblue" skrev i meddelelsen
...
Dim rng As Range
With Worksheets("Data")
Set rng = .Range("a2", .Range("a" & Rows.count).End(xlUp))
End With
rng.Select
--------------------

With above code I select all data in column A.
How can I select all data in row 1.
I mean what is the equal code for selecting columns in a row ?
Thank you.


darkblue

selecting data in a row
 
On Feb 6, 4:54*pm, "Per Jessen" wrote:
HI

Look at this:

Dim Rng2 As Range
With Worksheets("Data")
* * * *Set rng = .Range("a2", .Range("a" & Columns.Count).End(xlToLeft))
End With

Regards,
Per

"darkblue" skrev i ...



Dim rng As Range
With Worksheets("Data")
* * * Set rng = .Range("a2", .Range("a" & Rows.count).End(xlUp))
End With
rng.Select
--------------------


With above code I select all data in column A.
How can I select all data in row 1.
I mean what is the equal code for selecting columns in a row ?
Thank you.- Hide quoted text -


- Show quoted text -



Thank you so much Per.

Mike H

selecting data in a row
 
Hi,

One way with the usual caveat that it is very unlikely you need to select
the range to do what you want.

Dim rng As Range
With Worksheets("Sheet1")
LastCol = .Cells(1, Columns.Count).End(xlToLeft).Column
Set rng = .Range(Cells(1, 1), Cells(1, LastCol))
End With
rng.Select

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"darkblue" wrote:

Dim rng As Range
With Worksheets("Data")
Set rng = .Range("a2", .Range("a" & Rows.count).End(xlUp))
End With
rng.Select
--------------------

With above code I select all data in column A.
How can I select all data in row 1.
I mean what is the equal code for selecting columns in a row ?
Thank you.

.


darkblue

selecting data in a row
 
On Feb 6, 5:31*pm, Mike H wrote:
Hi,

One way with the usual caveat that it is very unlikely you need to select
the range to do what you want.

Dim rng As Range
With Worksheets("Sheet1")
LastCol = .Cells(1, Columns.Count).End(xlToLeft).Column
Set rng = .Range(Cells(1, 1), Cells(1, LastCol))
End With
rng.Select

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.



"darkblue" wrote:
Dim rng As Range
With Worksheets("Data")
* * * *Set rng = .Range("a2", .Range("a" & Rows.count).End(xlUp))
End With
rng.Select
--------------------


With above code I select all data in column A.
How can I select all data in row 1.
I mean what is the equal code for selecting columns in a row ?
Thank you.


.- Hide quoted text -


- Show quoted text -


Thank you very much Mike.


All times are GMT +1. The time now is 06:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com