Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

have a comment inserted into an excel spreadsheet using VB

Posted on 2007-11-27
2
Medium Priority
?
766 Views
Last Modified: 2012-08-13
I want to insert a comment into a file that instructs the user to click on insert and then function/standard deviation.
The code as it is:

Set objExcel = CreateObject("Excel.Application")
 
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Comment.Add "My comment"
objExcel.Cells(1, 1).Value = "Date"
objExcel.Cells(1,2).Value = "Student"
objExcel.Cells(1,3).Value = "Wk1"
objExcel.Cells(1,4).Value = "Wk2"
objExcel.Cells(1,5).Value = "Wk3"
objExcel.Cells(1,6).Value = "Wk4"
objExcel.Cells(1,7).Value = "Wk5"
objExcel.Cells(1,8).Value = "Wk6"
objExcel.Cells(1,9).Value = "Wk7"
objExcel.Cells(1,10).Value = "Wk8"
objExcel.Cells(1,11).Value = "Mean"
objExcel.Cells(2,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(1,13).Value = "Click on insert on taskbar then choose function and add the formula for the standard deviation and then copy and paste into the cells below"
objExcel.Cells(3,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(4,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(5,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(6,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(7,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(8,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(9,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(10,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(11,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(12,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(13,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(14,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(15,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(16,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(17,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(18,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(19,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(20,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(21,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(22,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(23,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(24,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(25,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(26,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(27,11).Value = "=SUM(A3:A10)/8"
objExcel.Cells(28,11).Value = "=SUM(A3:A10)/8"
 
objExcel.Cells(1,12).Value = "S.D"

Open in new window

0
Comment
Question by:Dier02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
EDDYKT earned 2000 total points
ID: 20364890
change
objExcel.Comment.Add "My comment"

to

objExcel.range("a1").addcomment
objExcel.range("a1").comment.Text Text:="My Comment"
0
 

Author Comment

by:Dier02
ID: 20546020
comes up with error if I copy it into notepad as save as a .vbs file then double click on it to run.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question