Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Non contiguous to contiguous

Hi

My data is in non-contiguous cells within a named range "Data" (C8:AG18)

Could someone please assist with a macro that will copy the data from al
cells containing data within this range and place them contiguously in a column for charting purposes

Thank U
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Non contiguous to contiguous

Neal,

Try this -

Sub PlaceData()

Dim rng As Range
Dim c As Range
Dim rngPlace As Range

'set this to be the starting point for your data
Set rngPlace = ActiveSheet.Range("G1")

For Each rng In ActiveWorkbook.Names("Data").RefersToRange.Areas
For Each c In rng
rngPlace.Value = c.Value
Set rngPlace = rngPlace.Offset(1, 0)
Next c
Next rng

End Sub

--
HTH,
Dianne Butterworth

In ,
Neal typed:
Hi,

My data is in non-contiguous cells within a named range "Data"
(C8:AG18).

Could someone please assist with a macro that will copy the data from
all
cells containing data within this range and place them contiguously
in a column for charting purposes.


Thank U



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Non contiguous to contiguous

Thanks Dianne

One problem....cells without data in them are also sent to the mergeplace, therefore i get a lot of blank cells in the column
Can we first check to make sure the cell to be merged does contain data

Regard
Nea

----- Dianne Butterworth wrote: ----

Neal

Try this

Sub PlaceData(

Dim rng As Rang
Dim c As Rang
Dim rngPlace As Rang

'set this to be the starting point for your dat
Set rngPlace = ActiveSheet.Range("G1"

For Each rng In ActiveWorkbook.Names("Data").RefersToRange.Area
For Each c In rn
rngPlace.Value = c.Valu
Set rngPlace = rngPlace.Offset(1, 0
Next
Next rn

End Su

--
HTH
Dianne Butterwort

In
Neal typed
Hi
My data is in non-contiguous cells within a named range "Data

(C8:AG18)
Could someone please assist with a macro that will copy the data fro

al
cells containing data within this range and place them contiguousl
in a column for charting purposes
Thank




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Non contiguous to contiguous

Sure...

Sub PlaceData()

Dim rng As Range
Dim c As Range
Dim rngPlace As Range

'set this to be the starting point for your data
Set rngPlace = ActiveSheet.Range("G1")

For Each rng In ActiveWorkbook.Names("Data").RefersToRange.Areas
For Each c In rng
If c.Value < "" Then
rngPlace.Value = c.Value
Set rngPlace = rngPlace.Offset(1, 0)
End If
Next c
Next rng

End Sub

--
HTH,
Dianne Butterworth

In ,
Neal typed:
Thanks Dianne,

One problem....cells without data in them are also sent to the
mergeplace, therefore i get a lot of blank cells in the column. Can
we first check to make sure the cell to be merged does contain data?

Regards
Neal

----- Dianne Butterworth wrote: -----

Neal,

Try this -

Sub PlaceData()

Dim rng As Range
Dim c As Range
Dim rngPlace As Range

'set this to be the starting point for your data
Set rngPlace = ActiveSheet.Range("G1")

For Each rng In
ActiveWorkbook.Names("Data").RefersToRange.Areas For
Each c In rng rngPlace.Value = c.Value
Set rngPlace = rngPlace.Offset(1, 0)
Next c
Next rng

End Sub

--
HTH,
Dianne Butterworth

In ,
Neal typed:
Hi,
My data is in non-contiguous cells within a named range "Data"

(C8:AG18).
Could someone please assist with a macro that will copy the

data from all
cells containing data within this range and place them

contiguously in a column for charting purposes.
Thank U



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
Non-contiguous selection Kay Excel Discussion (Misc queries) 3 May 9th 08 05:20 AM
Non-contiguous cells Kokomojo Excel Discussion (Misc queries) 2 November 6th 07 04:09 PM
Average non contiguous row Scott Kieta Excel Discussion (Misc queries) 5 July 10th 07 08:56 PM
Summing non contiguous cells Millie Excel Discussion (Misc queries) 4 August 10th 06 10:23 PM
contiguous reference jjeff Excel Discussion (Misc queries) 4 August 10th 06 10:07 PM


All times are GMT +1. The time now is 05:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"