View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
john john is offline
external usenet poster
 
Posts: 97
Default Need to Pull Data into a Comment

I'd be happy to give it a shot, but you need to clarify
the basis for finding the right cells on sheet 2.

Would it be possible to name the ranges on sheet 2 and
then refer to these names?

John
-----Original Message-----
I am just learning VBA and am stuck on a procedure I am

trying to write.
I have 2 worksheets: sheet1 is a summary of sheet2.

Example: The
sheets have the following data:
Sheet1:
A1: 4
Sheet 2:
D5: 1
E6: 3

I want to place a comment in Sheet1 A1 that reads:
AP = 1
Forecast = 3

The "1" and the "3" gets pulled from the Sheet2 D5 and E6

cells and
updates automatically when Sheet1 is activated. I have

done this part
with no problem using the following code in the Sheet1

module:

Private Sub Worksheet_Activate()
Range("A1").Comment.Text Text:=Chr(10) & "AP = " _
& Sheets("Calculations").Range("D5").Value & Chr(10) & _
"Forecast = " & Sheets("Calculations").Range("E5").Value
End Sub

Note: Sheets("Calculations") is Sheet2

However, the problem is that there are about 100 cells

that need this
same comment that pulls data from Sheet2, but from

different cells.
How do I write the code so that the comment knows where

to look on
Sheet2 to pull the data?

Any suggestions at all are much appreciated!!


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

.