Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to sheet1 data goes to sheet2 automaticaly ? | Excel Worksheet Functions | |||
copy data from sheet2 to sheet1 when sheet2 has variable # of rows | Excel Discussion (Misc queries) | |||
Function on Sheet1 based on data on Sheet2 | Excel Worksheet Functions | |||
copying data from sheet1 to sheet2 | Excel Worksheet Functions | |||
How To Retrieve Data from Sheet2 into Sheet1 | Excel Worksheet Functions |