Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default Range maneuvers question


Is there a standard command in a macro that will move one to the bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Range maneuvers question

Hi,

To select the last populated cell in a column use

Cells(Cells.Rows.Count, "A").End(xlUp).Select

One caveat is that it is highly unlikely you actually need to select the
cell to do what you want.

Mike

"CellShocked" wrote:


Is there a standard command in a macro that will move one to the bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default Range maneuvers question

I want to highlight the entire sheet (minus the header row),
and clear the contents just before a refill with updated data.

Unless there is a query (of sorts) that only replaces changed data or
adds new data.

That would actually be the right way to go, but I fear that a 180k
record sheet might be a while performing that act.

So, I simply kill the original data, and paste in the current
replacement.

No insight on the error problem, eh?

Thanks for your help though.

I think all I need is a select command, but I also want to exclude the
header row. I could simply replace it as well I suppose though.

Here it is, if you are high bandwidth and like you DVD collection.

It is a bit kludgey as I never used any dialogs to speak of, and no
error trapping routines anywhere.


On Sun, 3 Jan 2010 14:30:01 -0800, Mike H
wrote:

Hi,

To select the last populated cell in a column use

Cells(Cells.Rows.Count, "A").End(xlUp).Select

One caveat is that it is highly unlikely you actually need to select the
cell to do what you want.

Mike

"CellShocked" wrote:


Is there a standard command in a macro that will move one to the bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default Range maneuvers question

Forgot to include the link:

http://www.mediafire.com/?tytzztygiqr



On Sun, 03 Jan 2010 14:51:45 -0800, CellShocked
<cellshocked@thecellvalueattheendofthespreadsheet. org wrote:

I want to highlight the entire sheet (minus the header row),
and clear the contents just before a refill with updated data.

Unless there is a query (of sorts) that only replaces changed data or
adds new data.

That would actually be the right way to go, but I fear that a 180k
record sheet might be a while performing that act.

So, I simply kill the original data, and paste in the current
replacement.

No insight on the error problem, eh?

Thanks for your help though.

I think all I need is a select command, but I also want to exclude the
header row. I could simply replace it as well I suppose though.

Here it is, if you are high bandwidth and like you DVD collection.

It is a bit kludgey as I never used any dialogs to speak of, and no
error trapping routines anywhere.


On Sun, 3 Jan 2010 14:30:01 -0800, Mike H
wrote:

Hi,

To select the last populated cell in a column use

Cells(Cells.Rows.Count, "A").End(xlUp).Select

One caveat is that it is highly unlikely you actually need to select the
cell to do what you want.

Mike

"CellShocked" wrote:


Is there a standard command in a macro that will move one to the bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Range maneuvers question

To select the last cell, regardless of any blank cells in the range,
select the range and use

With Selection
.Cells(.Cells.Count).Select
End With

To select the last cell with data in it, use

With Selection
.Cells.SpecialCells(xlCellTypeConstants). _
SpecialCells(xlCellTypeLastCell).Select
End With

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]






On Sun, 03 Jan 2010 14:51:45 -0800, CellShocked
<cellshocked@thecellvalueattheendofthespreadsheet. org wrote:

I want to highlight the entire sheet (minus the header row),
and clear the contents just before a refill with updated data.

Unless there is a query (of sorts) that only replaces changed data or
adds new data.

That would actually be the right way to go, but I fear that a 180k
record sheet might be a while performing that act.

So, I simply kill the original data, and paste in the current
replacement.

No insight on the error problem, eh?

Thanks for your help though.

I think all I need is a select command, but I also want to exclude the
header row. I could simply replace it as well I suppose though.

Here it is, if you are high bandwidth and like you DVD collection.

It is a bit kludgey as I never used any dialogs to speak of, and no
error trapping routines anywhere.


On Sun, 3 Jan 2010 14:30:01 -0800, Mike H
wrote:

Hi,

To select the last populated cell in a column use

Cells(Cells.Rows.Count, "A").End(xlUp).Select

One caveat is that it is highly unlikely you actually need to select the
cell to do what you want.

Mike

"CellShocked" wrote:


Is there a standard command in a macro that will move one to the bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.
.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Range maneuvers question

This will clear the sheet execpt row 1.

Sub sl()
Dim x As String
x = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Address
ActiveSheet.Range("A2:" & x).ClearContents
End Sub





"CellShocked" <cellshocked@thecellvalueattheendofthespreadsheet. org wrote
in message ...
I want to highlight the entire sheet (minus the header row),
and clear the contents just before a refill with updated data.

Unless there is a query (of sorts) that only replaces changed data or
adds new data.

That would actually be the right way to go, but I fear that a 180k
record sheet might be a while performing that act.

So, I simply kill the original data, and paste in the current
replacement.

No insight on the error problem, eh?

Thanks for your help though.

I think all I need is a select command, but I also want to exclude the
header row. I could simply replace it as well I suppose though.

Here it is, if you are high bandwidth and like you DVD collection.

It is a bit kludgey as I never used any dialogs to speak of, and no
error trapping routines anywhere.


On Sun, 3 Jan 2010 14:30:01 -0800, Mike H
wrote:

Hi,

To select the last populated cell in a column use

Cells(Cells.Rows.Count, "A").End(xlUp).Select

One caveat is that it is highly unlikely you actually need to select the
cell to do what you want.

Mike

"CellShocked" wrote:


Is there a standard command in a macro that will move one to the
bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened
in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.
.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Range maneuvers question

It would have helped had you mentioned about clearing the contents in your
original post!!

JLGWhiz has given you a solution

"CellShocked" wrote:

I want to highlight the entire sheet (minus the header row),
and clear the contents just before a refill with updated data.

Unless there is a query (of sorts) that only replaces changed data or
adds new data.

That would actually be the right way to go, but I fear that a 180k
record sheet might be a while performing that act.

So, I simply kill the original data, and paste in the current
replacement.

No insight on the error problem, eh?

Thanks for your help though.

I think all I need is a select command, but I also want to exclude the
header row. I could simply replace it as well I suppose though.

Here it is, if you are high bandwidth and like you DVD collection.

It is a bit kludgey as I never used any dialogs to speak of, and no
error trapping routines anywhere.


On Sun, 3 Jan 2010 14:30:01 -0800, Mike H
wrote:

Hi,

To select the last populated cell in a column use

Cells(Cells.Rows.Count, "A").End(xlUp).Select

One caveat is that it is highly unlikely you actually need to select the
cell to do what you want.

Mike

"CellShocked" wrote:


Is there a standard command in a macro that will move one to the bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.
.

.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default Range maneuvers question

On Sun, 3 Jan 2010 18:35:07 -0500, "JLGWhiz" wrote:

This will clear the sheet execpt row 1.

Sub sl()
Dim x As String
x = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell) .Address
ActiveSheet.Range("A2:" & x).ClearContents
End Sub


You Da Man!

Go Chargers!
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default Range maneuvers question



I guess that you have reading issues.

What other reasons would one want to select an entire sheet's contents,
and why would you get so miffed over it?

Is there a ****ing contest to see which of you can help first or
something?

Jeez... raise your maturity level above that of a ten year old, dude.

In other words, excuse the f*ck out of me.

Thanks, guys for the help. That works fine. Thanks for yours too,
issues boy. :-)

As far as the rest goes... I guess nobody is familiar with anything 2010
here then.
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Range maneuvers question

The error 400 occurs when you try to open a UserForm that is already loaded
and displayed. So, if you are getting that error when you open workbook,
you need to check the ThisWorkbook code module to see if there is a
Workbook_Open event code that is calling a UserForm that might already be
open. If not, then you need to try and isolate the cause that initiates the
error and report it for a possible bug in the 2010 beta version.



"CellShocked" <cellshocked@thecellvalueattheendofthespreadsheet. org wrote
in message ...

Is there a standard command in a macro that will move one to the bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 277
Default Range maneuvers question

On Tue, 5 Jan 2010 15:26:32 -0500, "JLGWhiz" wrote:

The error 400 occurs when you try to open a UserForm that is already loaded
and displayed. So, if you are getting that error when you open workbook,
you need to check the ThisWorkbook code module to see if there is a
Workbook_Open event code that is calling a UserForm that might already be
open. If not, then you need to try and isolate the cause that initiates the
error and report it for a possible bug in the 2010 beta version.



No, I am certain that it is in my macro script.

Thanks. I need to trap for the condition of the workbook, and act
accordingly. Thanks again.


"CellShocked" <cellshocked@thecellvalueattheendofthespreadsheet. org wrote
in message ...

Is there a standard command in a macro that will move one to the bottom
of a range?

The row count varies, and I always want to get to the bottom, and
recording a macro doesn't work as it uses direct references.

Also, for some reason, ever since I opened this workbook in 2010 beta,
I get a 400 error in my sheet manipulation routine. It never happened in
2007, but now even happens in that release. Did opening change something
about the workbook that I do not know about?

It used to work fine.

I do think that I have a very recent, pre-2010 backup, however. I
haven't tried to see if that one does it as well. If it does, does that
make it a registry problem, since my 2010 install was told to keep the
current version intact? Both are 32 bit. The 2007 is pro, and the 2010
is a beta offering I DLd from MS.


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
Range question Jock Excel Worksheet Functions 3 March 19th 08 04:36 PM
Range question JamesJordan Excel Programming 2 April 5th 06 11:24 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM
Range question strataguru[_19_] Excel Programming 2 September 25th 04 12:57 AM
Range.Formula and Range question using Excel Automation [email protected] Excel Programming 0 September 19th 03 04:53 AM


All times are GMT +1. The time now is 04:10 PM.

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

About Us

"It's about Microsoft Excel"