Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default how to fill gaps in Current Region?

I have a table with 56 columns and use Range("A2").CurrentRegion property to
copy it to another worksheet (archive). If each column contains at least one
value everything is OK. But sometimes one or more columns do not contain any
values (cells are empty). In this case CurrentRegion stops on first empty
column. Is it possible to use all the 56 table columns despite any possible
gaps in it?

Thank you in advance for your help.

Mike510


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to fill gaps in Current Region?


If you can use an explicit range eg. "A2:CA100" I would do so, otherwise
this will copy to the REAL last cell :-

'-----------------------------------------------------
Sub LastCell()
Set foundcell = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByRows)
'------------------------
ActiveSheet.Range(Cells(2, 1), Cells(foundcell.Row,
foundcell.Column)).Copy
End Sub
'------------------------------------------------------


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default how to fill gaps in Current Region?

Range("A2").CurrentRegion.Resize(,56).copy

--
Regards,
Tom Ogilvy


Mikhail wrote in message
...
I have a table with 56 columns and use Range("A2").CurrentRegion property

to
copy it to another worksheet (archive). If each column contains at least

one
value everything is OK. But sometimes one or more columns do not contain

any
values (cells are empty). In this case CurrentRegion stops on first empty
column. Is it possible to use all the 56 table columns despite any

possible
gaps in it?

Thank you in advance for your help.

Mike510




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default how to fill gaps in Current Region?

Assuming there is always data in col A this code should do what you
want

Range(Range("A2"), Range("A2").End(xlDown).Offset(0, 56)).Select


DavidP

On Tue, 11 Nov 2003 16:12:12 +0300, "Mikhail"
wrote:

I have a table with 56 columns and use Range("A2").CurrentRegion property to
copy it to another worksheet (archive). If each column contains at least one
value everything is OK. But sometimes one or more columns do not contain any
values (cells are empty). In this case CurrentRegion stops on first empty
column. Is it possible to use all the 56 table columns despite any possible
gaps in it?

Thank you in advance for your help.

Mike510


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default how to fill gaps in Current Region?

Dear Excel experts!
Thank you all for your valuable help.
IMHO the most elegant solution is Range("A2").CurrentRegion.Resize(,56).copy
Thank you again.
Mike510


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
Current region emulation daverau Excel Worksheet Functions 5 October 16th 09 04:31 AM
Sort doesn't recognize current region RobWN Excel Worksheet Functions 2 September 7th 07 10:48 PM
Naming Current Region Gavin[_4_] Excel Programming 3 October 14th 03 03:38 PM
Trying to convert a used range into a current region a Excel Programming 2 September 25th 03 06:00 AM


All times are GMT +1. The time now is 06:47 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"