Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am a newby at macros - so be kind! Can I name ranges within a worksheet
and then write a loop so that I can perform the same functions on each range? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
SaraJane
Something like this may work for you. You can add as many range names as you want. HTH Otto Sub LoopThruNames() Dim TheName As Variant For Each TheName In Array("ThisName", "ThatName", "OtherName") 'Code that operates on "TheName", for instance: MsgBox Range(TheName).Address(0, 0) Next End Sub "SaraJane" <u34526@uwe wrote in message news:72b853dc12db5@uwe... I am a newby at macros - so be kind! Can I name ranges within a worksheet and then write a loop so that I can perform the same functions on each range? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sara Jane
Give us an idea what you are trying to do specifically -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS web: www.nickhodge.co.uk blog (non-tech): www.nickhodge.co.uk/blog/ "SaraJane" <u34526@uwe wrote in message news:72b853dc12db5@uwe... I am a newby at macros - so be kind! Can I name ranges within a worksheet and then write a loop so that I can perform the same functions on each range? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I converted a PDF file to excel. I want to convert this data to a usable
form. Each record (l'll call them indiviidual well data) extends to many columns and rows. I want to name each record "well" and then perform the exact same functions on each of these records. Is that specific enough? Nick Hodge wrote: Sara Jane Give us an idea what you are trying to do specifically I am a newby at macros - so be kind! Can I name ranges within a worksheet and then write a loop so that I can perform the same functions on each range? |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sara Jane
It is tough to know exactly what you have and you've had one suggestion. You can iterate collections, so for example if you have a range of A1:C100 you could do this to work on each object in the collection Dim myCell as Range For Each myCell in Range("A1:C100") myCell.Value=MyCell.Value+1 Next myCell -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS web: www.nickhodge.co.uk blog (non-tech): www.nickhodge.co.uk/blog/ "SaraJane" <u34526@uwe wrote in message news:72b90906b6d57@uwe... I converted a PDF file to excel. I want to convert this data to a usable form. Each record (l'll call them indiviidual well data) extends to many columns and rows. I want to name each record "well" and then perform the exact same functions on each of these records. Is that specific enough? Nick Hodge wrote: Sara Jane Give us an idea what you are trying to do specifically I am a newby at macros - so be kind! Can I name ranges within a worksheet and then write a loop so that I can perform the same functions on each range? |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Is there any common factor that differentiates one record from another?
Blank row between? Same number of rows per set? Gord Dibben MS Excel MVP On Fri, 25 May 2007 21:47:58 GMT, "SaraJane" <u34526@uwe wrote: I converted a PDF file to excel. I want to convert this data to a usable form. Each record (l'll call them indiviidual well data) extends to many columns and rows. I want to name each record "well" and then perform the exact same functions on each of these records. Is that specific enough? Nick Hodge wrote: Sara Jane Give us an idea what you are trying to do specifically I am a newby at macros - so be kind! Can I name ranges within a worksheet and then write a loop so that I can perform the same functions on each range? |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes, one row between record and yes the same number of rows per set
Gord Dibben wrote: Is there any common factor that differentiates one record from another? Blank row between? Same number of rows per set? Gord Dibben MS Excel MVP I converted a PDF file to excel. I want to convert this data to a usable form. Each record (l'll call them indiviidual well data) extends to many [quoted text clipped - 8 lines] and then write a loop so that I can perform the same functions on each range? -- Sara Jane |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
SaraJane,
It would help to know what 'function' you want to perform on each range. But, you could loop through the range areas. Try this test macro with the sheet active: Sub Test() Dim myArea As Range Dim myCells As Range Dim i As Integer i = 0 Set myCells = Cells.SpecialCells(xlCellTypeConstants) MsgBox "There are " & myCells.Areas.Count & " ""wells"" of data" For Each myArea In myCells.Areas i = i + 1 MsgBox "Area #" & i & " is in cells " & myArea.Address Next myArea End Sub If this macro appears to count the correct number of 'wells', then we can apply functions once we know what you want. HTH, Bernie MS Excel MVP "SaraJane" <u34526@uwe wrote in message news:72baefb8bb50f@uwe... Yes, one row between record and yes the same number of rows per set Gord Dibben wrote: Is there any common factor that differentiates one record from another? Blank row between? Same number of rows per set? Gord Dibben MS Excel MVP I converted a PDF file to excel. I want to convert this data to a usable form. Each record (l'll call them indiviidual well data) extends to many [quoted text clipped - 8 lines] and then write a loop so that I can perform the same functions on each range? -- Sara Jane |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes, one row between record and yes the same number of rows per set
Gord Dibben wrote: Is there any common factor that differentiates one record from another? Blank row between? Same number of rows per set? Gord Dibben MS Excel MVP I converted a PDF file to excel. I want to convert this data to a usable form. Each record (l'll call them indiviidual well data) extends to many [quoted text clipped - 8 lines] and then write a loop so that I can perform the same functions on each range? -- Sara Jane |
#10
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes, one row between record and yes the same number of rows per set
Gord Dibben wrote: Is there any common factor that differentiates one record from another? Blank row between? Same number of rows per set? Gord Dibben MS Excel MVP I converted a PDF file to excel. I want to convert this data to a usable form. Each record (l'll call them indiviidual well data) extends to many [quoted text clipped - 8 lines] and then write a loop so that I can perform the same functions on each range? -- Sara Jane |
#11
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
See Bernie's post with code to loop through each set.
As Bernie says"what will you do with each set"? Transpose to one row per set or? Gord On Sat, 26 May 2007 01:25:28 GMT, "SaraJane" <u34526@uwe wrote: Yes, one row between record and yes the same number of rows per set Gord Dibben wrote: Is there any common factor that differentiates one record from another? Blank row between? Same number of rows per set? Gord Dibben MS Excel MVP I converted a PDF file to excel. I want to convert this data to a usable form. Each record (l'll call them indiviidual well data) extends to many [quoted text clipped - 8 lines] and then write a loop so that I can perform the same functions on each range? |
#12
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes, one row between record and yes the same number of rows per set
Gord Dibben wrote: Is there any common factor that differentiates one record from another? Blank row between? Same number of rows per set? Gord Dibben MS Excel MVP I converted a PDF file to excel. I want to convert this data to a usable form. Each record (l'll call them indiviidual well data) extends to many [quoted text clipped - 8 lines] and then write a loop so that I can perform the same functions on each range? -- Sara Jane |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loops | Excel Discussion (Misc queries) | |||
Loops... | Excel Discussion (Misc queries) | |||
do loops | Excel Worksheet Functions | |||
For next loops | Excel Discussion (Misc queries) | |||
Using For - Next Loops in VB | New Users to Excel |