Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default range selection problem

i have a sheet with bunches of data, i have a button when pressed t
copy the first 23 rows of data, opens a new sheet them copies it over
then i have to return the the first sheet and search for certain dat
to copy over as well. i have the code but for some reason th
original selected 23 rows stay selected, i even put

Range("A1").Select

to selecta cell to get rid of the highlighted stuf, then it searche
for the data and copies it, but some reason it doesnt highlight th
next set of data.

Range("A23:Q23").Select

this command selects a1 and copies that. i tell it not to though, here
what i have.

If (G23 1) Then Range("A23:Q23").Select
Selection.Copy
ActiveWindow.ActivateNext
ActiveWindow.WindowState = xlNormal
ActiveSheet.Range("A23:Q23").Select
ActiveSheet.Paste

End Sub

thats without the range("a1.... which would be right about IF.
is there somehting else i can put in to unselect the origina
highlighted data so it can then highlight something else. ive tried

Application.CutCopyMode = False

also. any ideas

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default range selection problem

Sub Tester10()
Dim sh As Worksheet
Set sh = ActiveSheet
ActiveWindow.ActivateNext
Set sh2 = ActiveSheet
If sh.Range("G3").Value 1 then
sh.Range("A23:Q23").Copy Destination:= _
sh2.Range("A23:Q23")
End if
sh.Parent.window.Activate
End Sub

Should avoid the need to highlight.

--
Regards,
Tom Ogilvy



"derekc " wrote in message
...
i have a sheet with bunches of data, i have a button when pressed to
copy the first 23 rows of data, opens a new sheet them copies it over,
then i have to return the the first sheet and search for certain data
to copy over as well. i have the code but for some reason the
original selected 23 rows stay selected, i even put

Range("A1").Select

to selecta cell to get rid of the highlighted stuf, then it searches
for the data and copies it, but some reason it doesnt highlight the
next set of data.

Range("A23:Q23").Select

this command selects a1 and copies that. i tell it not to though, heres
what i have.

If (G23 1) Then Range("A23:Q23").Select
Selection.Copy
ActiveWindow.ActivateNext
ActiveWindow.WindowState = xlNormal
ActiveSheet.Range("A23:Q23").Select
ActiveSheet.Paste

End Sub

thats without the range("a1.... which would be right about IF.
is there somehting else i can put in to unselect the original
highlighted data so it can then highlight something else. ive tried

Application.CutCopyMode = False

also. any ideas?


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default range selection problem

gave error on last line of code.

sh.Parent.window.Activate

thanks for help thoug

--
Message posted from http://www.ExcelForum.com

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
Narrow Range based on Selection in Another Range David Excel Discussion (Misc queries) 3 July 1st 07 05:12 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM
Creating range name for a range selection Mervyn Thomas Excel Programming 1 January 26th 04 05:18 PM
Range selection problem SotjeRuud Excel Programming 1 August 27th 03 12:41 PM


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