LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Code for current sheet selected...

Easy way

Set thisSheet = Activesheet
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B3").Select
ActiveWindow.ScrollWorkbookTabs Sheets:=-1
Sheets("CP093004").Select
Range("B3").Select
Selection.Copy
Sheets("CP031005").Select
Range("B3").Select
thisSheet.Activate

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Brad" wrote in message
...
I have the following code generated from a macro:

Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B3").Select
ActiveWindow.ScrollWorkbookTabs Sheets:=-1
Sheets("CP093004").Select
Range("B3").Select
Selection.Copy
Sheets("CP031005").Select
Range("B3").Select
...

and, I want to run the macro from a newly imported sheet, so, what can I

put
in place of

Sheets("CP031005").Select

so that it selects the current sheet from which the macro was called?

My thanks in advance for any help. Brad





 
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
Macro to run relative to current selected cell MahD Excel Discussion (Misc queries) 3 December 11th 06 06:18 AM
Excel should enlarge the current selected row for easy reading Office_Power_User Excel Worksheet Functions 1 September 21st 05 09:00 PM
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. Daniel Excel Worksheet Functions 1 July 12th 05 01:30 AM
how can one obtain the current selected cell value Susan Hayes Excel Programming 3 December 14th 04 10:31 AM
plotting chart with user selected range from current workbook annette2002 Excel Programming 0 June 5th 04 03:16 AM


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