![]() |
Sort by Variables
OK, I'm one step further then my last question. How do I SORT using string
variables? Am I close? dim itype1 as integer dim itype2 as integer dim itype3 as interger itype1 = "Cash Equivalent" itype2 = "Bond" itype3 = "Common Stock" |
Sort by Variables
dim itype1 as integer
dim itype2 as integer dim itype3 as interger Dim res1 as variant, res2 as variant, res3 as variant Dim rng1 as Range, rng2 as Range, rng3 as Range itype1 = "Cash Equivalent" itype2 = "Bond" itype3 = "Common Stock" res1 = Application.Match(itype1,Rows(1),0) res2 = Application.Match(itype2,Rows(1),0) res3 = Application.Match(itype2,Rows(1),0) if not iserror(res1) and not iserror(res2) and not iserror(res3) then set rng1 = cells(1,res1) set rng2 = cells(1,res2) set rng3 = cells(1,res3) Range("A1").currentRegion.Sort _ Key1:=rng1, order1:=xlAscending, _ Key2:=rng2, order2:=xlAscending, _ Key3:=rng3, order3:=xlAscending, _ Header:=xlYes,OrderCustom:=1, _ MatchCase:=False, Orientation:=xlTopToBottom -- Regards, Tom Ogilvy "SharonInGa" wrote in message ... OK, I'm one step further then my last question. How do I SORT using string variables? Am I close? dim itype1 as integer dim itype2 as integer dim itype3 as interger itype1 = "Cash Equivalent" itype2 = "Bond" itype3 = "Common Stock" |
All times are GMT +1. The time now is 12:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com