I am trying to create a small VB program that will take a list of numbers in excel and put it into a single cell.
Example:
Turn this:
-547119.67
-19700.00
-2170.50
115.00
10504.56
186131.59
-75669.81
17180.82
-44261.34
Into this:
=-547119.67-19700-2170.50+115+10504.56+186131.59-75669.81+17180.82-44261.34
I need have it so the cells reads out as a single number, not text. Also, I need to do this in VB because I will be surrounding it with other parameters to select which numbers in the list to use.
Thanks for any Help!!
5 1088
I am trying to create a small VB program that will take a list of numbers in excel and put it into a single cell.
Thanks for any Help!!
use FOR - NEXT or DO-LOOP and CELLS... may be WORKSHEETS
this might give you a general idea: - sub something()
-
dim i as long
-
dim b as double
-
for i = 1 to 10
-
b= b + cells(i,1)
-
next
-
cells(1,2)=b
-
end sub
will sum A1:A10 and write the result in B1
well
HTH
Oh in case i misunderstood the question - sub something()
-
dim i as long
-
dim b as string
-
b = "="
-
for i = 1 to 10
-
if mid(cells(i,1),1,1)="-" then
-
b= b & cells(i,1)
-
else
-
b= b & "+" & cells(i,1)
-
end if
-
next
-
cells(1,2)=b
-
end sub
this might be of help as well
use FOR - NEXT or DO-LOOP and CELLS... may be WORKSHEETS
will sum A1:A10 and write the result in B1
well
HTH
That is a good start, but in addtion to this I need the out put cell to have all the numbers in the formula, not just the sum.
Any ideas?
Oh in case i misunderstood the question - sub something()
-
dim i as long
-
dim b as string
-
b = "="
-
for i = 1 to 10
-
if mid(cells(i,1),1,1)="-" then
-
b= b & cells(i,1)
-
else
-
b= b & "+" & cells(i,1)
-
end if
-
next
-
cells(1,2)=b
-
end sub
this might be of help as well
That's it!!!
Thanks so much!!!
That is a good start, but in addtion to this I need the out put cell to have all the numbers in the formula, not just the sum.
Any ideas?
yes, sorry, check post #3
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dleecurt |
last post by:
Hello, I have a small problem, I am trying to write a program that
will calculate the Fibonacci number series, and I have the code
complete with one problem. I used a long in to store the numbers,...
|
by: Allen Thompson |
last post by:
Is there a script that will round off a number to a certain number of
decimal places? -Allen Thompson
|
by: Stavros Christoforou |
last post by:
Hello everyone,
I was wondering if someone could help me with an issue I have in C++. I
want to select random points within the volume of a sphere. I know how
to get random numbers using srand()...
|
by: MConly |
last post by:
Can you tell me what happens inside CPU when I rand() ?
Where can I find the true rand function implemented ? I have heard
that rand() in C/C++ is n't a good one but why it isn't a good one,
are...
|
by: Eduardo Bezerra |
last post by:
Hi,
I'm looking for an efficient way to create the oposite of a
list of numbers.
For example, suppose I have this list of numbers:
100
200
300
|
by: JoelPJustice |
last post by:
I am working through a VBA book by myself to help and try and improve my skills. However, the book does not give you solutions to certain problems. I have worked through this problem up until bullet...
|
by: vj |
last post by:
Hi!
I have a piece of code (shown below) involving complex numbers. The
code is not running and giving error ("Invalid floating point
operation" and "SQRT:Domain error"). I would be very...
|
by: Frederick Gotham |
last post by:
I have a general idea about how negative number systems work, but I'd
appreciate some clarification if anyone would be willing to help me.
Let's assume we're working with an 8-Bit signed integer,...
|
by: Reggie |
last post by:
Hi and TIA! I'm exporting a dataset/datgrid to excel but some text fields
get converted to numbers in excel and I loose leading zero's. I've tried
several methods with no success. If anyone has...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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: 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...
|
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...
| |