![]() |
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 |
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/ |
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 |
All times are GMT +1. The time now is 03:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com