Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi I'm trying to create a function that will drop the first row in a given
range object and return a new range object - to eliminate headers from a range object. so something like this??? Function dropFirstCell(ByVal r As Range) As Range Dim r2 As Range Dim i As Integer i = 2 Set r2 = r.Range(Cells(i), Cells(r.Rows.Count)) Set dropFirstCell = r2 End Function can anyone help? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
We build the output range one cell at a time:
Function rout(rin As Range) As Range Set r1 = rin.Cells(1, 1) rw1 = r1.Row Set rout = Nothing For Each rr In rin If rr.Row = rw1 Then Else If rout Is Nothing Then Set rout = rr Else Set rout = Union(rout, rr) End If End If Next End Function Sub tester() Dim r As Range Set r = Range("A1:F7") MsgBox (rout(r).Address) End Sub -- Gary''s Student - gsnu200814 "Rik" wrote: Hi I'm trying to create a function that will drop the first row in a given range object and return a new range object - to eliminate headers from a range object. so something like this??? Function dropFirstCell(ByVal r As Range) As Range Dim r2 As Range Dim i As Integer i = 2 Set r2 = r.Range(Cells(i), Cells(r.Rows.Count)) Set dropFirstCell = r2 End Function can anyone help? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to return a range of values in a drop-down. | Excel Worksheet Functions | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Return contents of cell at Index position in Source Range of Drop | Excel Programming | |||
Range Question / error 1004: method Range of object Worksheet has failed | Excel Programming | |||
using RANGE object in multiple-area range | Excel Programming |