Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
a a is offline
external usenet poster
 
Posts: 51
Default Trying to convert a used range into a current region

Hi, I was hoping that somebody could help me with this.

I have non-continguous ranges and I want to copy the formula down to the
bottom of the column "at" but the rows in between the non-contiguous
ranges prevent this because the intersection is using the current region
rather than the used range. Is there a way to do use the intersection
on the used range instead the current region? As you can see - I try to
convert the current region into the used range - but that clearly didn't
work.

Thanks much in advance for any help you can provide.

anita

Sub EngDeleteRows()
Dim lastRow As Long
Dim rng As Range

Application.ScreenUpdating = False
'insert dummy field name
ActiveSheet.Unprotect password:="nope"
Range("at13").Value = "temp"
Range("at14").Formula = "=RC[-17]+RC[-5]+RC[-1]"
Range("at14").Activate
ActiveSheet.UsedRange.Select
CurrentRegion = ActiveSheet.UsedRange 'my lame attempt
Range("at14").Activate
Intersect(Range(ActiveCell, _
Cells(Rows.Count, ActiveCell.Column)), _
ActiveCell.CurrentRegion).FillDown
With ActiveSheet
.UsedRange 'reset last cell
'determine last row
lastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
'set rng to the B column data rows
Set rng = Range("at14", Cells(lastRow, "at"))
'filter the B column to show only the data to be deleted
rng.AutoFilter Field:=1, Criteria1:="0", Operator:=xlOr, _
Criteria2:="="

'delete the visible cells, including dummy field name
rng.SpecialCells(xlCellTypeVisible).EntireRow.Dele te
.UsedRange 'reset the last cell
Range("a1").Select
End With
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Trying to convert a used range into a current region

Intersect(Range(ActiveCell, _
Cells(Rows.Count, ActiveCell.Column)), _
ActiveCell.Parent.UsedRange).FillDown


--
Regards,
Tom Ogilvy


a wrote in message
nk.net...
Hi, I was hoping that somebody could help me with this.

I have non-continguous ranges and I want to copy the formula down to the
bottom of the column "at" but the rows in between the non-contiguous
ranges prevent this because the intersection is using the current region
rather than the used range. Is there a way to do use the intersection
on the used range instead the current region? As you can see - I try to
convert the current region into the used range - but that clearly didn't
work.

Thanks much in advance for any help you can provide.

anita

Sub EngDeleteRows()
Dim lastRow As Long
Dim rng As Range

Application.ScreenUpdating = False
'insert dummy field name
ActiveSheet.Unprotect password:="nope"
Range("at13").Value = "temp"
Range("at14").Formula = "=RC[-17]+RC[-5]+RC[-1]"
Range("at14").Activate
ActiveSheet.UsedRange.Select
CurrentRegion = ActiveSheet.UsedRange 'my lame attempt
Range("at14").Activate
Intersect(Range(ActiveCell, _
Cells(Rows.Count, ActiveCell.Column)), _
ActiveCell.CurrentRegion).FillDown
With ActiveSheet
.UsedRange 'reset last cell
'determine last row
lastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
'set rng to the B column data rows
Set rng = Range("at14", Cells(lastRow, "at"))
'filter the B column to show only the data to be deleted
rng.AutoFilter Field:=1, Criteria1:="0", Operator:=xlOr, _
Criteria2:="="

'delete the visible cells, including dummy field name
rng.SpecialCells(xlCellTypeVisible).EntireRow.Dele te
.UsedRange 'reset the last cell
Range("a1").Select
End With
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
a a is offline
external usenet poster
 
Posts: 51
Default Thank you Tom Ogilvy

Thank you - Tom Ogilvy!

I haven't tried this yet - it's my bedtime - but your stuff always works
and I've already sent it to work.

Thanks again,
Anita

Tom Ogilvy wrote:

Intersect(Range(ActiveCell, _
Cells(Rows.Count, ActiveCell.Column)), _
ActiveCell.Parent.UsedRange).FillDown


--
Regards,
Tom Ogilvy


a wrote in message
nk.net...

Hi, I was hoping that somebody could help me with this.

I have non-continguous ranges and I want to copy the formula down to the
bottom of the column "at" but the rows in between the non-contiguous
ranges prevent this because the intersection is using the current region
rather than the used range. Is there a way to do use the intersection
on the used range instead the current region? As you can see - I try to
convert the current region into the used range - but that clearly didn't
work.

Thanks much in advance for any help you can provide.

anita

Sub EngDeleteRows()
Dim lastRow As Long
Dim rng As Range

Application.ScreenUpdating = False
'insert dummy field name
ActiveSheet.Unprotect password:="nope"
Range("at13").Value = "temp"
Range("at14").Formula = "=RC[-17]+RC[-5]+RC[-1]"
Range("at14").Activate
ActiveSheet.UsedRange.Select
CurrentRegion = ActiveSheet.UsedRange 'my lame attempt
Range("at14").Activate
Intersect(Range(ActiveCell, _
Cells(Rows.Count, ActiveCell.Column)), _
ActiveCell.CurrentRegion).FillDown
With ActiveSheet
.UsedRange 'reset last cell
'determine last row
lastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
'set rng to the B column data rows
Set rng = Range("at14", Cells(lastRow, "at"))
'filter the B column to show only the data to be deleted
rng.AutoFilter Field:=1, Criteria1:="0", Operator:=xlOr, _
Criteria2:="="

'delete the visible cells, including dummy field name
rng.SpecialCells(xlCellTypeVisible).EntireRow.Dele te
.UsedRange 'reset the last cell
Range("a1").Select
End With
End Sub






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..Cntrl Asterick ManhattanRebel Excel Discussion (Misc queries) 3 November 27th 09 05:15 PM
convert existing range of dates to to current year, maintaining mm Lin24 New Users to Excel 4 October 27th 09 08:04 PM
Current region emulation daverau Excel Worksheet Functions 5 October 16th 09 04:31 AM
Paste values all cells in a region which refers to out of region Vijay Excel Worksheet Functions 0 August 25th 09 06:03 AM
Sort doesn't recognize current region RobWN Excel Worksheet Functions 2 September 7th 07 10:48 PM


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