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

I have a range that reads right to left (column
A2:F1517). I would like to take the range and put the
values into one single column, preferably on another
worksheet.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Manipulating a Range

Hi
one way:

dim swks as worksheet
dim twks as workshee
Dim rng as range
dim cell as range
dim row_index as long
application.screenupdating=false
set swks=activesheet
set twks as worksheet("sheet2")
set rng=swks.range("A1:F1000")
row_index=1
for each cell in rng
twks.cells(row_index,1).valuecell.value
row_index=row_index+1
next
application.screenupdating=true




-----Original Message-----
I have a range that reads right to left (column
A2:F1517). I would like to take the range and put the
values into one single column, preferably on another
worksheet.


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Manipulating a Range

Thanks. When I run the routine I getting a compile error
at set twks as worksheet("sheet2")

Sub Saxon999()

Dim swks As Worksheet
Dim twks As Worksheet
Dim rng As Range
Dim cell As Range
Dim row_index As Long
Application.ScreenUpdating = False
Set swks = ActiveSheet
set twks as worksheet("sheet2")
Set rng = swks.Range("A2:F1518")
row_index = 1
For Each cell In rng
twks.Cells(row_index, 1).valuecell.Value
row_index = row_index + 1
Next
Application.ScreenUpdating = True

End Sub
-----Original Message-----
Hi
one way:

dim swks as worksheet
dim twks as workshee
Dim rng as range
dim cell as range
dim row_index as long
application.screenupdating=false
set swks=activesheet
set twks as worksheet("sheet2")
set rng=swks.range("A1:F1000")
row_index=1
for each cell in rng
twks.cells(row_index,1).valuecell.value
row_index=row_index+1
next
application.screenupdating=true




-----Original Message-----
I have a range that reads right to left (column
A2:F1517). I would like to take the range and put the
values into one single column, preferably on another
worksheet.


.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Manipulating a Range

That's one of the risks when a responder is in too much of a hurry to
take the time to test code before posting it; it should be
Set twks = Worksheets("Sheet2"). There's also a similar "haste makes
waste" problem at the line

twks.Cells(row_index, 1).valuecell.Value which should be
twks.Cells(row_index, 1).value = cell.Value

Alan Beban

Pablo wrote:

Thanks. When I run the routine I getting a compile error
at set twks as worksheet("sheet2")

Sub Saxon999()

Dim swks As Worksheet
Dim twks As Worksheet
Dim rng As Range
Dim cell As Range
Dim row_index As Long
Application.ScreenUpdating = False
Set swks = ActiveSheet
set twks as worksheet("sheet2")
Set rng = swks.Range("A2:F1518")
row_index = 1
For Each cell In rng
twks.Cells(row_index, 1).valuecell.Value
row_index = row_index + 1
Next
Application.ScreenUpdating = True

End Sub

-----Original Message-----
Hi
one way:

dim swks as worksheet
dim twks as workshee
Dim rng as range
dim cell as range
dim row_index as long
application.screenupdating=false
set swks=activesheet
set twks as worksheet("sheet2")
set rng=swks.range("A1:F1000")
row_index=1
for each cell in rng
twks.cells(row_index,1).valuecell.value
row_index=row_index+1
next
application.screenupdating=true





-----Original Message-----
I have a range that reads right to left (column
A2:F1517). I would like to take the range and put the
values into one single column, preferably on another
worksheet.


.


.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Manipulating a Range

Pablo wrote:
I have a range that reads right to left (column
A2:F1517). I would like to take the range and put the
values into one single column, preferably on another
worksheet.


I don't know what you mean by "reads right to left", but if the
functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook, the
following will return the elements from the first sheet,
Range("A2:F1517"), to the second sheet, Range("A1:A9096"),
with the value from Cell B2 on the 1st sheet in Cell A2 of the 2nd
sheet. If instead you want the value from A3 of the 1st sheet in Cell
A2 of the 2nd sheet, change the last line to
rng2.Value = ArrayReshape(rng1, n, 1, "c").

Sub a()
Dim rng1 As Range, rng2 As Range, n As Long
Set rng1 = Sheets(1).Range("A2:F1517")
n = rng1.Count
Set rng2 = Sheets(2).Range("a1:a" & n)
rng2.Value = ArrayReshape(rng1, n, 1)
End Sub

Alan Beban


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
Changing/Manipulating Legend range for a Pivot Chart in XL2010 vsXL2003 and below. Grumpy Aero Guy Charts and Charting in Excel 0 March 26th 11 10:31 PM
Help With Manipulating Data Pat Excel Discussion (Misc queries) 3 November 21st 08 01:41 PM
manipulating dates ghostinhawaii Excel Worksheet Functions 2 March 24th 07 05:16 AM
Manipulating a Filtered Range - I know its been done zestpt Excel Programming 4 July 7th 04 10:42 PM
Manipulating DOS from VBA Dave Peterson[_3_] Excel Programming 0 October 17th 03 01:46 AM


All times are GMT +1. The time now is 09:10 AM.

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"