LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Need some help with more effective range manipulation

Hi all,

I see alot on here about not using select and active or the like when
editing excel code for efficiency. So I am practicing on revising some code I
have, but I am running into a few problems.

Here is my code, my questions are below it.

Dim testrange As String
Dim SortRangeX As String

testrange = InputBox(prompt:="Enter Column Letter", Title:="Sort")
SortRangeX = testrange & ":" & testrange

Range("4:28").Copy
Sheets("Sort").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlFormulas
Application.CutCopyMode = False
Selection.Sort Key1:=Range(SortRangeX), Order1:=xlDescending
Selection.Copy
Sheets("Main Scorecard (All FSEs)").Select
Range("A4").Select
Selection.PasteSpecial Paste:=xlFormulas
Application.CutCopyMode = False

Now keep in mind, that this is copying from "Main Scorecard(All FSEs)" and
pasting to "Sort" sheet sorting and placing it back into the original sheet.
Here are some issues I have when revising it.

I could do
Range("4:28").Copy
Sheets.("Sort").Range("A1").paste special Paste:=XlFormulas

However the focus is still on the main sheet, and I cannot figure out how to
execute the sort on the sorting sheet without selecting it first.

Also, is there a way to get the range.copy and sheets.range.paste special
all in one line?
 
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
What would be the most effective way to do this? Joan Pham Excel Worksheet Functions 5 August 3rd 09 09:40 PM
For better Performance in VBA for Excel - Strings manipulation OR Objects manipulation vmegha Excel Programming 2 December 19th 05 12:14 AM
Range manipulation shishi Excel Programming 1 August 4th 05 08:23 PM
Range Manipulation Question [email protected] Excel Programming 2 April 5th 05 11:20 PM
A More Effective Way of Using PasteSpecial? CalumMurdo Kennedy Excel Programming 7 October 30th 03 02:49 AM


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