Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Current region emulation | Excel Worksheet Functions | |||
Sort doesn't recognize current region | Excel Worksheet Functions | |||
Naming Current Region | Excel Programming | |||
Trying to convert a used range into a current region | Excel Programming |