Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 408
Default Recordset - Urgent help need

Hi folks,

I have the following data (partial data - Total over 2000 records.) in excel
spreadsheet - sheet1. I would like to select top 10 of sales and multiply
the commission by 1.05 in ado recordset and update the commision column.
Please help.

Thanks in advance.
Tim.

Name Sales Commission
Pete 1000 40
John 500 20
Dave 1900 76
Mary 566 22.64

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Recordset - Urgent help need

Maybe something like this...

Sub Macro1()

Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Sort Key1:=Range("B2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1:C11").Select
Selection.Copy
Range("E1").Select
ActiveSheet.Paste
Range("H2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=RC[-1]*1.05"
Range("H2").Select
Selection.AutoFill Destination:=Range("H2:H11")
Range("H2:H11").Select
End Sub

Regards,
Ryan---

PS, a Pivot Table will give you the top 10 as well...

--
RyGuy


"Tim" wrote:

Hi folks,

I have the following data (partial data - Total over 2000 records.) in excel
spreadsheet - sheet1. I would like to select top 10 of sales and multiply
the commission by 1.05 in ado recordset and update the commision column.
Please help.

Thanks in advance.
Tim.

Name Sales Commission
Pete 1000 40
John 500 20
Dave 1900 76
Mary 566 22.64

  #3   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 408
Default Recordset - Urgent help need

Hi ryguy7272,

Thanks for your code but I can't use it because I can't change the order.
It links to orher spreadsheet and I can't add any sheet neither because it is
protected. Therefore, I think ado recordset will be my only choice. Could
you show me how to use ado recordset?

Thanks in advance.
Tim.

"ryguy7272" wrote:

Maybe something like this...

Sub Macro1()

Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Sort Key1:=Range("B2"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1:C11").Select
Selection.Copy
Range("E1").Select
ActiveSheet.Paste
Range("H2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=RC[-1]*1.05"
Range("H2").Select
Selection.AutoFill Destination:=Range("H2:H11")
Range("H2:H11").Select
End Sub

Regards,
Ryan---

PS, a Pivot Table will give you the top 10 as well...

--
RyGuy


"Tim" wrote:

Hi folks,

I have the following data (partial data - Total over 2000 records.) in excel
spreadsheet - sheet1. I would like to select top 10 of sales and multiply
the commission by 1.05 in ado recordset and update the commision column.
Please help.

Thanks in advance.
Tim.

Name Sales Commission
Pete 1000 40
John 500 20
Dave 1900 76
Mary 566 22.64

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
IME MODE FOR EXCEL 2007 (URGENT URGENT) Stella Wong Excel Discussion (Misc queries) 1 August 23rd 08 11:16 PM
Urgent-Urgent VBA LOOP Jeff Excel Discussion (Misc queries) 0 October 6th 05 05:46 PM
Type recordset/recordset? FlaviusFlav[_9_] Excel Programming 4 May 24th 04 12:16 PM
Macro help urgent urgent Dave Peterson[_3_] Excel Programming 0 September 4th 03 03:59 PM
Macro help urgent urgent chandra Excel Programming 0 September 4th 03 03:50 PM


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