473,549 Members | 2,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you add 2 numbers together in VB from a worksheet?

anoble1
245 New Member
Hi,

I have an excel sheet that has a graph in it. The graph is a line graph and has bars that contain 2 numbers that add together that create 1 bar. I have made a textbox that has "Active X" functions on it. meaning that the textbox pulls from VB code. Anyone know of the code to grab numbers from a worksheet and add them together?

EX:
Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_Change()
  2. Sheets("Sheet1").Select
  3. Range("F4:G4").Select
  4. textbox = F4.value+G4.value
  5. End Sub
Maybe something like that but that will not work.

i am just trying to populate a textbox with VB by adding 2 numbers from a worksheet.
Apr 5 '13 #1
2 2114
ADezii
8,834 Recognized Expert Expert
There are several ways to accomplish this, namely:
  1. Directly assign Result to Textbox on Form:
    Expand|Select|Wrap|Line Numbers
    1. TextBox1 = Cells(4, 6) + Cells(4, 7)
    2. TextBox2 = Range("F4") + Range("G4")
    3.  
  2. Apply Formula to Cell:
    Expand|Select|Wrap|Line Numbers
    1. =SUM(F4:G4)
Apr 5 '13 #2
Rabbit
12,516 Recognized Expert Moderator MVP
This thread has been moved to the new Excel forum.
Apr 5 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
6815
by: Tommy Lang | last post by:
Lets say you have a read (using cin >> ) a couple of numbers that the user have entered ie. 1234. And you want to add these numbers together like this, 1+2+3+4=10 How do you do that? Thanks, Tommy
11
3614
by: MickG | last post by:
Hi, Im trying to add 3 numbers together, instead of getting 1+2+3=6, I'm getting 123, how could I remedy this. ManyThanks in advance Michael <html>
33
9903
by: patrick_woflian | last post by:
hey guys, im just writing a basic calculation at the moment, before building on it for an A-Level piece of work. i can add/divide etc... two numbers together yet i am having a major problem with the following calculation: z = x! / (x- y)! The following code is my attempt and i was hoping for a point in the right direction as too where i...
13
2780
by: Peter Oliphant | last post by:
I would like to be able to create a random number generator that produces evenly distributed random numbers up to given number. For example, I would like to pick a random number less than 100000, or between 0 and 99999 (inclusive). Further, the I want the range to be a variable. Concretely, I would like to create the following method: ...
1
1908
by: crystalgal | last post by:
Help. I am using Excel to enter in daily numbers in worksheet 2. I want to use vb (w/in excel) to create a command button in worksheet 1. I want to enter a date in a cell and click the command button. I then want to use the date i entered into the cell to sum the total of numbers from worksheet 2 by filtering the numbers by the date. I want to...
4
1128
by: Michelle Monty | last post by:
Hi. I'm trying to create a program where a user can type in a 5 digit number and my program has to add the first and third digit numbers together. I'm having difficulty getting the program to work. I'm using Visual Basic 2005. Any advice?
14
8643
by: thehobbit | last post by:
Hi, Could anyone give ideas on how to add 4 20 digit numbers in ANSI C and pass the result back to a calling program in COBOL? We were able to add up to 15 digit numbers without any problems, but we started facing issues once we go above 15 digits. Thanks, Venkat
2
3443
Thekid
by: Thekid | last post by:
I know python has math functions like 5+6 and 5*6 and 5/6 etc...but I have something like this: x=575124357 and need to add them all together: 5+7+5+1+2+4+3+5+8=40
1
1380
by: DaveRook | last post by:
Hello I am trying to add 2 numbers together which live on an Access database. My table looks like http://www.globalconnectortechnology.com/image.jpg If a customer wanted a total height of 3, I would show parts H1 and S2 because H1 has a height of 1 and S2 has a height of 2 (1+2=3)! If he wanted a total height of 2.5, I would showhim...
10
1849
by: edithgingras | last post by:
what am i missing here? #include <iostream> #include <string> using namespace std; int main() { // Declare Variables
0
7527
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7459
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7819
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5377
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5097
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1953
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.