UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Code Not Working    
 
   
John_Ross
post Apr 3 2012, 12:08 PM
Post #1

UtterAccess Veteran
Posts: 332



I’ve vba that works fine , except I want to include a Sum value of the range E7:E100 in the worksheet – Sheet1. I used the following vba but it’s giving me error:

Range(“F11”).Value = SUM(“E7:E100”)

What is worng with this line?
Go to the top of the page
 
+
Bob G
post Apr 3 2012, 12:11 PM
Post #2

UtterAccess VIP
Posts: 8,130
From: CT



as mentioned by Isaac in your other thread Copy Excel File.

CODE
ThisWorkbook.Worksheets("Sheet1").Range("A1").Value="Text"
Go to the top of the page
 
+
ipisors
post Apr 3 2012, 12:12 PM
Post #3

UtterAccess Certified!
Posts: 6,930
From: Arizona, United States



Drop the quotes around e7:e100

This post has been edited by ipisors: Apr 3 2012, 12:12 PM
Go to the top of the page
 
+
ipisors
post Apr 3 2012, 12:17 PM
Post #4

UtterAccess Certified!
Posts: 6,930
From: Arizona, United States



Technically, you would need to use:

Range(“F11”).Value = " =SUM(E7:E100) "

And yes, like Bob said, fully qualify this stuff.

ThisWorkbook.Worksheets("Sheet1").Range(“F11”).Value = " =SUM(E7:E100) "

When you start running code with users who may or may not have 2 other excel workbooks open at the same time, you'll start having weird results, if you don't fully qualify which book, which sheet, etc.


This post has been edited by ipisors: Apr 3 2012, 12:18 PM
Go to the top of the page
 
+
John_Ross
post Apr 3 2012, 12:17 PM
Post #5

UtterAccess Veteran
Posts: 332



When I drop the quotes, the line turns red.
Go to the top of the page
 
+
ipisors
post Apr 3 2012, 12:18 PM
Post #6

UtterAccess Certified!
Posts: 6,930
From: Arizona, United States



sorry, see my edited response
Go to the top of the page
 
+
John_Ross
post Apr 3 2012, 12:19 PM
Post #7

UtterAccess Veteran
Posts: 332



The new formula worked! Thank you.
Go to the top of the page
 
+
ipisors
post Apr 3 2012, 12:19 PM
Post #8

UtterAccess Certified!
Posts: 6,930
From: Arizona, United States



You have some weird kind of quotes in there. Replace them with regular quotes. seriously- that's what I found when I copied/pasted it into a module.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 08:44 AM