Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default xlUp Not Working

What might be wrong with the following code?

Sub Macro7()
Sheets(1).Columns("A:A").Select
Range("A1").Activate
Range(Selection, Selection.End(xlUp)).Select
End Sub

The code remains to be with complete column A:A selected instead of
selecting only the filled up cells.

All your help shall be appreciated.

--
Best Regards,

Faraz
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default xlUp Not Working

Hi again...

Sub Macro7()
Sheets(1).Select
Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row).Select
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Faraz A. Qureshi" wrote:

What might be wrong with the following code?

Sub Macro7()
Sheets(1).Columns("A:A").Select
Range("A1").Activate
Range(Selection, Selection.End(xlUp)).Select
End Sub

The code remains to be with complete column A:A selected instead of
selecting only the filled up cells.

All your help shall be appreciated.

--
Best Regards,

Faraz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default xlUp Not Working

If I'm understanding this correctly, you want to select the cells from
startinf from A1 that have data? If so, try this:

Sub Macro8()

With Sheets("Sheet1")
.Range(.Range("A1"), .Range("A1").End(xlDown)).Select
End With

End Sub

I think part of the issue is that you need to use a fully qualified
reference for the range. Hopefully this works or at least helps.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default xlUp Not Working

Wow!
Jacob! U R simply the best. By the way what was the reason of failure of the
former code which I had extracted via a recorded macro?
--
Best Regards,

Faraz


"Jacob Skaria" wrote:

Hi again...

Sub Macro7()
Sheets(1).Select
Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row).Select
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Faraz A. Qureshi" wrote:

What might be wrong with the following code?

Sub Macro7()
Sheets(1).Columns("A:A").Select
Range("A1").Activate
Range(Selection, Selection.End(xlUp)).Select
End Sub

The code remains to be with complete column A:A selected instead of
selecting only the filled up cells.

All your help shall be appreciated.

--
Best Regards,

Faraz

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default xlUp Not Working

Faraz

Thanks for your comments.. The below code extends the selection upwards .
Since you have already selected the entire column it does not make any
difference..To understand this better; try the below test

1
2
3
4

With the above data in cells A5:A9 . (All other cells are blank in column
A). Select cell A9 and run the below code...

Range(Selection, Selection.End(xlUp)).Select

Then select A15 and run the code again and see the difference...


If this post helps click Yes
---------------
Jacob Skaria


"Faraz A. Qureshi" wrote:

Wow!
Jacob! U R simply the best. By the way what was the reason of failure of the
former code which I had extracted via a recorded macro?
--
Best Regards,

Faraz


"Jacob Skaria" wrote:

Hi again...

Sub Macro7()
Sheets(1).Select
Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row).Select
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Faraz A. Qureshi" wrote:

What might be wrong with the following code?

Sub Macro7()
Sheets(1).Columns("A:A").Select
Range("A1").Activate
Range(Selection, Selection.End(xlUp)).Select
End Sub

The code remains to be with complete column A:A selected instead of
selecting only the filled up cells.

All your help shall be appreciated.

--
Best Regards,

Faraz

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Understanding .End(xlUp) (1,1) Dennis Excel Discussion (Misc queries) 4 April 4th 23 02:13 PM
End(xlUp) question CoolBusiness Excel Discussion (Misc queries) 4 March 26th 09 07:07 PM
xlup to find last row Curt Excel Programming 3 July 12th 07 04:26 PM
problem with .end(xlUp).row [email protected] Excel Discussion (Misc queries) 4 December 29th 06 01:24 PM
End(xlUp) m4nd4li4 Excel Programming 3 March 15th 05 07:57 PM


All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"