Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default help with worksheets

i have data in sheet one in one column and say many intermidiate rows

i want to copy that on a new sheet and then sort that


can anyone tell me how to do the linking using VBA


thanks in advance
indraneel

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,203
Default help with worksheets

This does not 'Link' cells, it makes copy from source on currently selected
sheet and then pastes it on a second sheet (Sheet2 here) and then sorts it.

Sub MoveAndSort()
'presumes source data in column A
'starting in row 1 and continuing with
'no empty cells to the end of the list
Range("A1:" & Range("A1").End(xlDown).Address).Select
Selection.Copy
'actually 'move' to second sheet
Worksheets("Sheet2").Select 'use name of sheet to move to
Range("B1").Select ' where you wish to put it
ActiveSheet.Paste
'sort on single column, no header
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
'or
'sort on single column, no header
' Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
' OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
' DataOption1:=xlSortNormal
End Sub

"indraneel" wrote:

i have data in sheet one in one column and say many intermidiate rows

i want to copy that on a new sheet and then sort that


can anyone tell me how to do the linking using VBA


thanks in advance
indraneel


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default help with worksheets

yes i can do this but the part that i am interested in really is that i
move a cell to the next sheet with an "=" sign

i mean that the value is not copy pasted but linked by a formula to
sheet 1 cause i have many values that i have to take care of so was
planning to make a do loopwhile statement

regards
indraneel

JLatham wrote:
This does not 'Link' cells, it makes copy from source on currently selected
sheet and then pastes it on a second sheet (Sheet2 here) and then sorts it.

Sub MoveAndSort()
'presumes source data in column A
'starting in row 1 and continuing with
'no empty cells to the end of the list
Range("A1:" & Range("A1").End(xlDown).Address).Select
Selection.Copy
'actually 'move' to second sheet
Worksheets("Sheet2").Select 'use name of sheet to move to
Range("B1").Select ' where you wish to put it
ActiveSheet.Paste
'sort on single column, no header
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
'or
'sort on single column, no header
' Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
' OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
' DataOption1:=xlSortNormal
End Sub

"indraneel" wrote:

i have data in sheet one in one column and say many intermidiate rows

i want to copy that on a new sheet and then sort that


can anyone tell me how to do the linking using VBA


thanks in advance
indraneel



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default help with worksheets

Sorry, but now the system is not notifying me of replies.

What you need to do is set up a loop that works from start to finish on the
source sheet and creates an "=Sheet!x##" kind of formula to place in each of
the destination cells. Something like the following. The Sort should still
work.

Sub MakeLinks()
Dim LC As Long
Dim LastRowToLink As Long

'get on your first sheet
Worksheets("Sheet1").Select
'go to first cell to link to
Range("A1").Select
'determine last row to link
LastRowToLink = Range("A1").End(xlDown).Row
'or for last use if blanks in between
LastRowToLink = Range("A" & Rows.Count).End(xlUp).Row
Do Until ActiveCell.Offset(LC, 0).Row LastRowToLink
'full reference to first destination on 2nd sheet
Worksheets("Sheet2").Range("B1").Offset(LC, 0).Formula = _
"=Sheet1!" & ActiveCell.Offset(LC, 0).Address
LC = LC + 1
Loop

End Sub
If you need more assistance: HelpFrom @ jlathamsite.com (no spaces).
"indraneel" wrote:

yes i can do this but the part that i am interested in really is that i
move a cell to the next sheet with an "=" sign

i mean that the value is not copy pasted but linked by a formula to
sheet 1 cause i have many values that i have to take care of so was
planning to make a do loopwhile statement

regards
indraneel

JLatham wrote:
This does not 'Link' cells, it makes copy from source on currently selected
sheet and then pastes it on a second sheet (Sheet2 here) and then sorts it.

Sub MoveAndSort()
'presumes source data in column A
'starting in row 1 and continuing with
'no empty cells to the end of the list
Range("A1:" & Range("A1").End(xlDown).Address).Select
Selection.Copy
'actually 'move' to second sheet
Worksheets("Sheet2").Select 'use name of sheet to move to
Range("B1").Select ' where you wish to put it
ActiveSheet.Paste
'sort on single column, no header
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
'or
'sort on single column, no header
' Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
' OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
' DataOption1:=xlSortNormal
End Sub

"indraneel" wrote:

i have data in sheet one in one column and say many intermidiate rows

i want to copy that on a new sheet and then sort that


can anyone tell me how to do the linking using VBA


thanks in advance
indraneel




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
Copy Worksheets from one Workbook to Another halem2 Excel Worksheet Functions 3 March 25th 06 06:04 AM
Adding same cells across multiple worksheets LACA Excel Worksheet Functions 2 January 19th 06 03:21 PM
Changing a Link Mid-way Across Worksheets Frosty Excel Worksheet Functions 0 August 25th 05 12:03 AM
Adding multiple worksheets Craig Excel Worksheet Functions 1 July 6th 05 07:21 PM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 10:05 PM


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