Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 11th, 2006, 04:56 AM
Authorized User
Join Date: Sep 2006
Location: , , .
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy only numeric value from one colum

Hi is it possible to copy only the numeric value from one colum to another colum in the same table?


    Selection.Font.Bold = True
    Selection.TypeText Text:="(ABILIFY 10 MG - CXS. 28 COMP.)"
    Selection.TypeText Text:="Preço/comp.: "
    Selection.Font.Bold = False
    Selection.TypeText Text:=" CINCO VIRGULA ZERO TRÊS UM SETE OITO SEIS EUROS + IVA…………………………………."
    Selection.Font.Size = 6
    Selection.Font.Size = 12
    Selection.Font.Bold = False
    Selection.TypeText Text:="N.º Reg. INFARMED: 5056387"
End Sub

I want to copy Selection.TypeText Text:="N.º Reg. INFARMED: 5056387"
only the numeric value of this cell (5056387) to another cell in the same table.

Reply With Quote
  #2 (permalink)  
Old October 16th, 2006, 08:26 AM
Friend of Wrox
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts


If there is always ": " after 'INFARMED' you could use the following simple method to extract the number from the string:

Sub strTest()

myStr = "N.º Reg. INFARMED: 5038756"
getStr = Mid(myStr, InStr(myStr, ": ") + 2)

Debug.Print getStr

End Sub


'sync' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
Reply With Quote
  #3 (permalink)  
Old October 16th, 2006, 08:31 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts

If the text like '"N.º Reg. INFARMED: 5056387"'
does not contain any other number other than what you expect (5056387)
you can use regular expressions to pull out the number alone.


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
From numeric to alfa numeric ebekir XSLT 1 August 10th, 2007 06:13 AM
Multi Colum Listbox JAdkins Classic ASP Basics 3 July 9th, 2007 01:40 AM
table colum break mateenmohd Classic ASP Basics 0 May 25th, 2007 10:10 AM
Copy only numeric value from one colum hugoscp Word VBA 1 November 22nd, 2006 10:56 AM
Loading a dropdown from a datagrid colum brenclarke VB.NET 2002/2003 Basics 1 May 30th, 2004 08:43 AM

All times are GMT -4. The time now is 08:25 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.