473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

anoble1
245 128KB
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 2110
ADezii
8,834 Expert 8TB
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 Expert Mod 8TB
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
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, ...
11
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
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...
13
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,...
1
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...
4
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....
14
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,...
2
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
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...
10
by: edithgingras | last post by:
what am i missing here? #include <iostream> #include <string> using namespace std; int main() { // Declare Variables
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.