Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Grab Last 4 Digits In A Cell


I have a cell with 9 digits in it. I am saving the file to a PDF giving it the name of the file plus I want to add the last four digits in cell A17.
ie. Filename 1234.pdf

How do I get the last four digits from a cell.?

Code:
a = Range("A17").value - first 5 digits 'format ####




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Enter Morethan 11 Digits In Excel Cell From Vb Code
hello


i am trying to enter morethan 11 digits(number) in excel cell from vb programme, but it is showing in scientic format. Pl. help me how to enter morethan 11 digits in excel cell from vb programme.

send to my mail id : gajulauma@yahoo.com

thanx
umasankar

Grab Text From Htm Cell/frame Into Textbox In VB
Hi

Grab text from htm cell/frame into Textbox in VB

I send string to the internet and get resunt into frame

I am traring to find out how I can grab the text from cell/table into textbox in VB

I did put To textbox 1 to 5 the text I am traing to put into textbox1 / 2 / 3 and 4

are somone ho know how to do this ??


<td valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="clsHeader" height="18"><span class="clsHeaderText">text1</span></td>
<td class="clsHeader"><span class="clsHeaderText">text2.</span></td>
<td class="clsHeader"><span class="clsHeaderText">text3</span></td>
<td class="clsHeader"><span class="clsHeaderText">text4</span></td>
<td class="clsHeader" align="right"><span class="clsHeaderText">text5</span></td>
</tr>

<tr class="clsListingTwo">
<td class="clsListing">To Textbox1</td>
<td class="clsListing">To Textbox2</td>
<td class="clsListing"><a href="search?&search=home&home">To Textbox3</a></td>
<td class="clsListing">o Textbox4</td>
<td class="clsListing" align="right">
''' maby better to grab this
<a href="javascript:search('To Textbox1','To Textbox4','To Textbox3');"> " border="0" hspace="6"></a>

</td>

Is There A Way To Remove Digits And Digits Only?
Is there a way to remove digits and digits only?

Hello, I feel a little embarrassed. An acquaitance
asked me a question. Namely, he works for a REIT
company and he has to put together a project where
they must retrieve various documents from the
archives. By convention, the documents are stored
according to the name of the street the property is
on, not by the street address number, and prefixes
such as "North" or "South" are ignored in ordering the
files.

He has an excel file with a list of all the
properties, but sadly, the properties are input with
the street number and directional prefixes (e.g.
"East" for "East Clinton" street) in the cell. So
sorting them in the Excel file would not at all
correspond with the order they would appear while
searching in the archives for them.

Is there a way to remove digits and digits only? I am
aware of Len and
http://office. microsoft. com/en-us/ excel/HA01154901 1033.aspx? pid=CL1005705510 33

Cell Format, Determining Type Of Cell Content (string/real/integer) And Cell Size
I am not sure whether I am at the right forum, but I am exporting Excel values in a Word document.

Unfortunately -my copy paste action doesn't take in account the cell_properties, so in some cases a value of 9,9999999999999999999999999999998E-4 is entered instead of the 9,9 E-4 or even 0,001 that is shown in the excel sheet.

I'm having trouble with finding the set format command (e.g. Tutbo Pascal: write(value:8:3) -or someting) and I also have strings in these cell -I am not sure if it gives any problems if one sets every zell to 2 decimals, if so -ho can I determin the type of cell content ...
And how to set the cell size to size of content

Could anyone help me, I 'm much obliged

Writing A Cell Address Of A Cell In 1 Worksheet To A Cell In Another In Same Workbook
Hi……..
Its an urgent requirement….
I have an excel sheet. I need to write the macros in VB for the following requirement:
There are three worksheets in a single workbook.. worksheet3 contains some values in every cell. whenever user writes in something in the cell in worksheet1, the column number and row number from worksheet3 must get written automatically in the adjucent cell in worksheet1 only.

For example:
A worksheet 3 contains PLZ A,B in row 5 and column 7. These rows and columns are user defined. If i write PLZ 31, 20 in F26 in worksheet 1 then automatically G26 must contain value 75, G27 must contain a value 31 and G28 must contain a value 20.

I can't say when this value should get populated. Either on the lost focus of F26 or i need to run a macro manually for F26.
 what would be the code in both the cases? Is the former case possible? If i select group of cells like F26 present in worksheet1 and altogether run a macro then would it give the result?

Thanks in advance for your reply.
Regards...
Priyadarshini

Non-digits
I'm not sure if this is the right area or not, but how do I make it so that only numbers can be entered into a textbox, or If It dedects that non-digit charachters are entered, It changes the text.

Digits
help!
i have an exercise on school which involve time (digital clock) recording i have made my vb and un the program but when i enter the hour, minute and second in the textbox the time in the label stop i don't know how to make it continue working... you help will be vey much apreciated, thanks!

How Many Digits
Is there a way you can tell how many digits are to the left of the deciaml point in a variable dimmed as single? And how can you tell if there are numbers to the left of the decimal point in a variable dimmed as a single?

Digits
Hello. i am Running VB 6.0. i am making a countdown clock for school and every time it gets one digit in seconds, like 19:09, it cuts off the 0 and says 19:9. How can i insure that the variable stays two digits?

Thanks

4 Digits
Hey people do you know how i can get 4 digits to be displayed in a text box?

Sum Of Digits
From memory, so no warranty of any kind


VB Code:
Function SumOfDigits (ByVal Number As Integer) As Integer    Dim r As Integer    Do While Number > 0        r = r + Number Mod 10        Number = Number / 10    Loop    SumOfDigits = rEnd Function

Digits
What's the easiest way to find the # of digits (or letters) in a string or in a int? Is there a built in function or do you have to do it manually?

2 Digits
Hello,

Since I am new with vb i have a little question.
I'm calculating in a ppc program some numbers and i want that the result
only have 2 digits after the comma. Can anyone helpme ?

SQL AND ADO SIG DIGITS
I am retrieving a value from the database that resides as "10.0" (a float value) When using Query Analyzer I am retrieving "10.0".

When I run a stored procedure and utilize the ADO object to display the value it shows a "10". "10" is not the same as "10.0" for my application.

Please let me know if there are any settings to ensure that the value is returned as inputted. The alternative I have is to store the values a varchar data.

Note: Implied decimal values will not work for this application. The significance of the data is not known prior to receiving it.

Thanks everyone!!

Getting Three Digits Off The Website
The use of my program requires it being added to the startup group. I may be a throwback for even considering these types of things, but because it's going to be permanently running in the background, I want to minimize the footprint in every way possible.

I do, however, want the program to be able to check what the latest version is on the website. All it needs is to pull down is three digits from the website, be it checking the filename of the latest version posted or reading a three character text file.

My question then is can I do this without adding a control? Is there some sort of API that could do this?

If the control is the only way to go, would INet be the best way (smallest footprint) to go about it?



thanks,

Inserting Digits
Ok, i know the solution is probably really simple but i don't really know what to search for when looking for a solution.

I am renaming files using a number ordering system but i need the files to be numbered as follows:

If the length of digits is only 2 then:
01, 02, 03, 04, 05...10, 11, 12, 13, 14, 15

If the length of digits is only 3 then:
001, 002, 003...010, 011, 012, 013...100, 101, 102, 103

Obviously i can get the length of digits as Len($String) so that's fine. I just need to know how to insert the preceding zero's (this is so that Windows lists them in the correct order).

Thank you for any help.

Long To Digits?
is there a way that i can divide a long into its seperate digits and put them in an array? ie-

x=1423

temp(0)=1
temp(1)=4
temp(2)=2
temp(3)=3

Preservation Of Digits
Hey!

Question:

MyString = "0001"
Is there an easy way to increment MyString, and still preserve four digits and leading zeros? Needless to say, I want this to work with numbers above 10, 100 and 1000 as well...

Thanks!
- cosmosis

Randomize 8 Digits
How would i make a random number 8 charaters long.

Displaying More Digits
Im having a problem here, Im showing an Array in a List and it is initialized with ceros. The thing is Iwant to display these ceros with 8 digits (0000000) but I can't find a generic way to do this so that if I put a number in the array say in the second field and the number has 2 digits (say 25) it fills the rest of the number with ceros (00000025). Anybody got ideas? Thx in advance

Display Two Digits
Hi,

How do I display an Integer values in two digits, For example I want to
dispaly 07 and not only 7.

Thanks in advanced...

Tzachi

Digits And Places
I know how to find which digit in a integer is where a number is
ex. x = instr(1, VAL(text1.Text), "3"
but how can i tell given the digit which number is in that certain place.
ex. 13535 How can I tell what number is in the 10's place? I asked earlier and was told to use digit = number AND 10^place/10^place where place is base zero starting from the ones place but i do not know what he meant?

Help With Empty Digits
I have the user enter a number from 99,999 To 2. I store each digit into a variable array. I can check each place value of the number to see what digit is in that place value. But if the user enters 00223, I get the "00" part in two seperate variables in the array. Those zeros are useless and it will screw up my calculations when I calculate the mean of the number. I need to know a way to tell the comp. which certain variables in the array are important or not. For example, Those "00" are not important but the zeros in 22300 are. How can I tell upto which number of variables in my 5 variable array to not include in calculations?

Value Only Got 9 Digits After Calculation (E+21)
I have made a program that i will add a regkey check for.
And i will crypt the key with - 331242342........ so it will be hard to crack it.
But when i take - 331242342........ i get "13434237E+21"
Can someone help me to ignore E+21 plz?.

Splitting Digits
Hi, in my project i have a variable that could be - 123.3. I want to split this up so that each digit is separate e.g. a=1,b=2,c=3,d=4. I have no idea how to do this can anyone help?
thanx.

Dividing Digits
i hav 3 textboxes and a command button. when i press the button after entering a number in one box it sould divide to other two boxes.eg:-
text1=12345678

text2=1234
text3=5678
how can i do it?
please help me

Forcing HEX To Four Digits
Hi,

I have a word of data eg, 01FF (in HEX). However, when I read in the variable the 0 is sometimes missing eg. 1FF. I would like a method of making sure (padding) the variable out to 4 digits.

I have used the format function: format(variable, "0000") and this displays the variable correctly, however, it does not modify the variable, so when I come to perform a calculation using it it gives me the wrong answer!!

Any suggestions, functions or comments.

Regards,
Tom Myers

Digits After Semicolum
Hello!!!
How can i arrange how many digits wil be shown after the semicolumn(sorry if i wrote it wrong) when i print something to a file.
Let's say that i declare i as double and a do this i/2 and when i print it i get 2.344895678987.How can i reduse the digits to this 2.3448(less numbers after semicolum)????
Thank's!!!

7 Digits Different Numbers
Hello,
I want to add 100 different 7 digits numbers in my table. Table Name is "Tbl_Serial". For example :

5689754
2365874
1258545
2552365
9632585
3658741
...
...
...
please help me

Number Gen With Different Digits
I am working on a program where the user can pick how many digits and it will generate txtNumber.text amout of a certain digit. Here is the code:


VB Code:
'Int((upperbound - lowerbound + 1) * Rnd + lowerbound)Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Private Sub cmdClear_Click()List1.ClearEnd Sub Private Sub cmdExit_Click()Unload MeEnd Sub Private Sub cmdGenerate_Click()Combo1.Enabled = FalsetxtNumber.Enabled = FalseProgressBar1.Max = txtNumber.TextProgressBar1.Value = 0lblStatus.Caption = "0/" + txtNumber.Text If Combo1.Text = 5 ThenFor x = 1 To txtNumber.Text'blahtempnumber = Int((99999 - 10000 + 1) * Rnd + 10000)List1.AddItem (tempnumber)Me.RefreshProgressBar1.Value = ProgressBar1.Value + 1tempr = ProgressBar1.ValuelblStatus.Caption = ProgressBar1.Value + "/" + txtNumber.TextSleep (50)NextEnd If If Combo1.Text = 6 ThenFor x = 1 To txtNumber.Text'blahtempnumber = Int((999999 - 100000 + 1) * Rnd + 100000)List1.AddItem (tempnumber)Me.RefreshProgressBar1.Value = ProgressBar1.Value + 1lblStatus.Caption = ProgressBar1.Value + "/" + txtNumber.TextProgressBar1.Value = ProgressBar1.Value + 1Sleep (50)NextEnd If If Combo1.Text = 7 ThenFor x = 1 To txtNumber.Text'blahtempnumber = Int((9999999 - 1000000 + 1) * Rnd + 1000000)List1.AddItem (tempnumber)Me.RefreshProgressBar1.Value = ProgressBar1.Value + 1lblStatus.Caption = ProgressBar1.Value + "/" + txtNumber.TextProgressBar1.Value = ProgressBar1.Value + 1Sleep (50)NextEnd If If Combo1.Text = 8 ThenFor x = 1 To txtNumber.Text'blahtempnumber = Int((99999999 - 10000000 + 1) * Rnd + 10000000)List1.AddItem (tempnumber)Me.RefreshProgressBar1.Value = ProgressBar1.Value + 1lblStatus.Caption = ProgressBar1.Value + "/" + txtNumber.TextProgressBar1.Value = ProgressBar1.Value + 1Sleep (50)NextEnd If Combo1.Enabled = TruetxtNumber.Enabled = TrueEnd SubPrivate Sub Form_Load()Combo1.AddItem ("5")Combo1.AddItem ("6")Combo1.AddItem ("7")Combo1.AddItem ("8")End Sub


I cant do the line that says :


VB Code:
lblStatus.Caption = ProgressBar1.Value + "/" + txtNumber.Text
and I dont know a way around that. All help is appreciated.

Vb Always Drops Digits?
I have an enormous amount of 27 digit numbers that I want to add together. vb seems to always convert the long number to an exponent and drops the last 9 digits, it looks like it can only handle 15 significant digits at once. Is there any way in vb to tell it to keep all 27 digits and not use exponents?

example

110000000010000100000000111 + 110000000010000100000000110
=
220000000020000200000000221

vb says the answer is 220000000020000000000000000

Extracting Digits
is there anyway of extracting digits from a number? For example, if i had an integer of 3345, how could i take out the first and second digit and then use them in a calculation? Thanks

Limiting Digits
I am trying to limit the amount of digits displayed in a text box to 3 digits. Well my problem is not the limitation it is when one of the numbers is a negative number.
I have set the MaxLength value to 3 which does the job of limiting the display to 3 digits. Example 3.5, 0.1, 9.4, etc.
My problem exists when the number is negative:
example -0.2, -3.5, -9.4
Well the display comes out to be -0. or -3.
which is not exactlly what I was going for.
Any ideas?

Digits Question
hey,

1. In vb, what represents any digit?
heres what i want to do..

If label3.Caption = "4digits" Then
Msgbox "blah blah"

Any help would be greatly appreciated, regards in advance.

Format To 5 Digits
Hi,

If I have a number that is only 4 digits long, how can I format it so it has 5.

e.g. 4533 -> 04533

Thanks
Nick

# Of Digits In Text Box
How can I get the number of digits the user placed in a Text box?

Calculating The Even Digits Only
I have taken courses for Visual Basic but i have never come across a problem that involves taking the Even digits only.
EXAMPLE: Here is a 15 digit number. 988015463728190
I have to add together the even digits: 988015463728190
_ 8 _ 0 _ 5 _ 6 _ 7 _ 8 _ 9
I have to take these numbers and add them together giving them a name called evens. 8+0+5+6+7+8+9
evens = 43

Now I have to take the odds and double them. Can someone help please?
TIA

Counting Digits
hi all, the situation is like this.........

i want to count the digits in my text box and determine how many digits are they in the text box. for example if the number is "4", the program will able to tell that there is only one digit in the text box. furthermore, if the number is "30" or "684" the program will tell that there is two digits or there digits. hope you guys get the picture and can help me on this. thanx in advance!

:how To Multiply All Digits Of A Given Value
hi this is my problem. for example i have a given value of 12345
what i need to do is to multiply all the digits like this:
 
1 X 2 X 3 X 4 X 5

i should have the output of 120.
how do i do that.. please help..



Edited by - milenyume on 10/10/2005 10:46:11 PM

Reverse Digits
Can anybody tell me how to create a way for a user to input digits in a text box, hit a command button which will then reverse the digits and display in a picture box?

Count The Number Of Digits
how will i count the number of digits in a number if it's declared as double? pls help me!

Getting Random Characters/digits
hiys guys/gurls

im writing a prog for my vb assessments that has to add a random character onto the end of the contents of a text box, atm i have Randomise in the Form_Load() event and the syntax

& Chr ( Int(Rnd() * (127-33) + 33 ))

which gives some random chars from the ASCII table at the end of the output from the text box, however when it is done adding chars to the range then thats it no more adding chars, and i need it to keep adding the chars something along the lines of

0000+
0000~
0000=
0000(

and when it completes one cycle it should then add say an X and repeat, eg when its done the first lot it should go something like

0000X+
0000X~
0000X=
0000X(

to bottom again then

0000XX+
0000XX~
0000XX=
0000XX(

etc till i give it a command to stop adding random chars

the commands to stop and start are easy enough and i managed to figure out the first method no problem and how to tell it to add itself to any given data in a txtBox and now i have tried so many variations im kinda losing it (LOL)

any guidance appreciated ty A

Adding Digits In A Number
Hey everyone! I searched for something like this buit could not find anthing. What I need to do is take a number like 123456789 and add each digit together. So it would be: 1+2+3+4+5+6+7+8+9=Whatever. I have tried a lot of different methods, but I can't seem to get it to work. Could some of you guys help me out? Thanx!

How To Swap The 4 Digits In One Text Box?
can someone help me on how to select 4 digit in one textbox and then swap them because i want to display those swapped digits in another labelbox

Forcing A Set Number Of Digits
This is probably a really simple question but how do I force my program to insert zeros infront of a number if it's not large enough? For example, I want all my numbers to have exactly 3 digits, so if the number is 19, I want it to store it as 019. I know you can use formatcurrency function to force 0's after the decimal, but how do you do it in my case? Thanks in advance.

Increment 5 Digits Number
Hello, I need help here. What I'm trying to do:

1) to has a function that will generate a unique 5 digits number that will increase everytime I call the function. I want to use it as slip number. It start from 00000 to 99999. If it more than 99999 then it will be reset to 00000.

2)this function will search in the table whether the number generated already existed or not, if yes it will increment the number if no then it will assign the number to the txtfields(1).

Below is my code but it doesn't work well.

code:
________________________________________________


Private Function tranNo()
Static code1 As Double
start:
txtFields(1).Text = Format(code1, "00000")
txtFields(1).Refresh
If code1 < 99999 Then

If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
If Adodc1.Recordset("tranNo") = code1 Then
code1 = code1 + 1
GoTo start:
Else
Adodc1.Recordset.MoveNext
End If
Loop

End If

Else
code1 = 0

End If


End Function

___________________________________________________

In summary, this number like an autonumber. Can anyone help me to correct the code, or suggest another way to do it? Help me please!

Formatting To Double Digits
I was wondering about formatting integer variables as double digits constantly. For example (01, 02, 03....09, 10, 11). I am constructing a clock function in my program and using a single label to display it. Eg, "08:01 pm" where i can only come up with "8:1 pm"within the label, so the variables themselves have to be formatted.


thanks,
drew
http://www.slickfire.com

Reading Digits Of An Applet
Well my problem is this.. im making an analysing program for a java applet game on a webpage and i want to read the read the score of the game. im thinking of taking a screen capture of the area in question and compare that with an pre made image.. (the background is black behind the digits)

now does anyone know how I can take a screen capture of an area if i have the cordinates?

Convert A Decimal Into Its Digits?
Using VB6...

Is it possible (and can anyone give me help / code for) to isolate the individual values of a decimal? It certainly has me puzzled...

For example:
Say I had the value "18.20" in one text box, and I wanted to pass each value as a parameter to a different routine, which would display the number on a virtual LCD display. The values would have to be variables, obviously, and the Loop would have to work backwards from the 0, as there are always 2 decimal places.

I have already written the subs involved in the converting, I just need to pass the values to them... from a text box value in the format "00.00".



Said variables would then be passed to the subroutines via something along the lines of:


Code:
Call Sub1(Var1)
Call Sub2(Var2)
Call Sub3(Var3)
Call Sub4(Var4)


Yes, I know it's confusing. I'm confused. I've been programming for about 6 months. But help would be greatly appreciated. Thanks in advance.

Copyright 2005-08 www.BigResource.com, All rights reserved