Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default refresh sheet2 with a sorted data from sheet1


Hi,

I have a workbook:
a. With 2 sheets called s1 and s2.
b. s1 contains 15 columns and 800 rows of unsorted data beginning at
c5.
c. Every day s1 gets a few more rows of data.

I would like s2 to:
1. Contain a sorted version of the data in s1.
2. The sorting criteria is by column 3 (ascending) then column 7
(decending) and then column 12 (ascending).

I would like s1 to:
1. Contain a button called "Sort now".
2. When this button is clicked, all the data in s2 starting at c5 is
cleared and replaced with the sorted version of the data in s1.
3. s1 should remain untouched as this contains the source of the
original data.

Can you please give me the VBA code for this "Sort now" button?

Thanks,
Luther


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default refresh sheet2 with a sorted data from sheet1

One way:

Public Sub CommandButton1_Click()
Dim rDest As Range

Set rDest = Sheets("s2").Range("C5")
rDest.Resize(Rows.Count - 4, 15).ClearContents
With Sheets("s1").Range("C5:Q" & _
Range("C" & Rows.Count).End(xlUp).Row)
Set rDest = rDest.Resize(.Rows.Count, 15)
rDest.Value = .Value
End With
rDest.Sort key1:=rDest(1), Order1:=xlAscending, Header:=xlNo
End Sub


In article ,
lothario wrote:

Hi,

I have a workbook:
a. With 2 sheets called s1 and s2.
b. s1 contains 15 columns and 800 rows of unsorted data beginning at
c5.
c. Every day s1 gets a few more rows of data.

I would like s2 to:
1. Contain a sorted version of the data in s1.
2. The sorting criteria is by column 3 (ascending) then column 7
(decending) and then column 12 (ascending).

I would like s1 to:
1. Contain a button called "Sort now".
2. When this button is clicked, all the data in s2 starting at c5 is
cleared and replaced with the sorted version of the data in s1.
3. s1 should remain untouched as this contains the source of the
original data.

Can you please give me the VBA code for this "Sort now" button?

Thanks,
Luther


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default refresh sheet2 with a sorted data from sheet1


Thanks

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
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
how to sheet1 data goes to sheet2 automaticaly ? ABDUSSALAM Excel Worksheet Functions 2 March 10th 10 04:12 PM
copy data from sheet2 to sheet1 when sheet2 has variable # of rows Anne Excel Discussion (Misc queries) 6 February 27th 09 09:48 PM
Function on Sheet1 based on data on Sheet2 Sony Excel Worksheet Functions 0 February 7th 07 04:44 PM
copying data from sheet1 to sheet2 Rookie Excel Worksheet Functions 3 September 7th 06 12:09 PM
How To Retrieve Data from Sheet2 into Sheet1 compconnj Excel Worksheet Functions 3 March 21st 06 07:56 PM


All times are GMT +1. The time now is 06:17 AM.

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

About Us

"It's about Microsoft Excel"