Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Pull data from inactive worksheet

Hi, all.

I've perused the threads and found nothing on the following (likely because
it's evident to everyone else!), and would like your help.

I have two worksheets, "Employees" and "Summary", in the same workbook.
When a user selects the Summary sheet and clicks a refresh button, I need to
grab the employee number from the row they had selected on the Employees
sheet. I cannot use ActiveCell, since Summary is now the active sheet.

What am I missing?

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Pull data from inactive worksheet

Try this...

Dim wks1 As Worksheet
Dim wks2 As Worksheet
Dim varVal1 As Variant

'Suppress screen updating
'Assign worksheets to variables
'Activate the Summary sheet, capture the activecells value
'Activate the Employee sheet and post the captured value
'to the active cell

Set wks1 = ActiveWorkbook.Worksheets("Employee")
Set wks2 = ActiveWorkbook.Worksheets("Summary")

Application.ScreenUpdating = False
wks2.Activate
varVal1 = ActiveCell.Value
wks1.Activate
ActiveCell.Value = varVal1

Set wks1 = Nothing
Set wks2 = Nothing

--
Kevin Backmann


"Pontificateur" wrote:

Hi, all.

I've perused the threads and found nothing on the following (likely because
it's evident to everyone else!), and would like your help.

I have two worksheets, "Employees" and "Summary", in the same workbook.
When a user selects the Summary sheet and clicks a refresh button, I need to
grab the employee number from the row they had selected on the Employees
sheet. I cannot use ActiveCell, since Summary is now the active sheet.

What am I missing?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Pull data from inactive worksheet

application.ScreenUpdating = False
worksheets("employees").Activate
set rng = ActiveCell
Worksheets("Summary").Activate
Application.ScreenUpdating = True
' option: display the cell address
'msgbox rng.Address(external:=True)

--
Regards,
Tom Ogilvy

"Pontificateur" wrote in message
...
Hi, all.

I've perused the threads and found nothing on the following (likely

because
it's evident to everyone else!), and would like your help.

I have two worksheets, "Employees" and "Summary", in the same workbook.
When a user selects the Summary sheet and clicks a refresh button, I need

to
grab the employee number from the row they had selected on the Employees
sheet. I cannot use ActiveCell, since Summary is now the active sheet.

What am I missing?

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Pull data from inactive worksheet

Thanks, Kevin and Tom!

You both pointed out the missing concept for me... namely that the code
should take control and activate the (inactive) worksheet momentarily to get
the cell!

I greatly appreciate your responses!



"Tom Ogilvy" wrote:

application.ScreenUpdating = False
worksheets("employees").Activate
set rng = ActiveCell
Worksheets("Summary").Activate
Application.ScreenUpdating = True
' option: display the cell address
'msgbox rng.Address(external:=True)

--
Regards,
Tom Ogilvy

"Pontificateur" wrote in message
...
Hi, all.

I've perused the threads and found nothing on the following (likely

because
it's evident to everyone else!), and would like your help.

I have two worksheets, "Employees" and "Summary", in the same workbook.
When a user selects the Summary sheet and clicks a refresh button, I need

to
grab the employee number from the row they had selected on the Employees
sheet. I cannot use ActiveCell, since Summary is now the active sheet.

What am I missing?

Thanks!




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
Pull data from one worksheet and place in a new worksheet smiall Excel Worksheet Functions 2 November 30th 09 08:06 PM
Search one worksheet to pull data into another worksheet HyperMite Excel Worksheet Functions 6 March 4th 09 01:53 PM
Pull data from various worksheet JMac[_2_] Excel Worksheet Functions 2 June 13th 08 03:58 PM
Using one worksheet to pull data from many Sara P. Excel Discussion (Misc queries) 1 July 13th 07 10:42 PM
ADO to pull data into another worksheet augustus Excel Programming 7 November 6th 04 01:19 AM


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