Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2006, 11:19 PM
Authorized User
 
Join Date: Nov 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Seperating a cell

I need to compare one cell formated like:12345678 to one formated like: 1234-5678 and copy the matched ones. I planned to compare the first four digits of the cell to the first four of the other, and then the last four likewise. I'm having trouble trying to seperate the cell into the first four. I thought it would be something like string1.textleft4 or something like that, I don't know, but it's not working. Any help in the right direction, or a better way, would be greatly appreciated.
 
Old November 14th, 2006, 11:30 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Hey Reverand,

Try this... if the number that needs altering is cell B2

=Left(B2, 4) & Right(B2, 4)

If you are then comparing that against a number, it may still be a problem because that may be considered a text string. (Of course it might not:D

If it does, I think the following might work...

=(Left(B2, 4) & Right(B2, 4)) * 1

Hope that helps,

Mike


Mike
EchoVue.com
 
Old November 14th, 2006, 11:46 PM
Authorized User
 
Join Date: Nov 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The second one worked, thank you very much sir.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Seperating Tickers keithd Excel VBA 1 January 28th, 2007 07:12 PM
I need to refer a cell within a cell like =RC[ RC2 chakravarthi_os Excel VBA 1 September 24th, 2006 08:19 AM
Seperating Layers rodmcleay BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 August 21st, 2006 10:38 AM
Seperating Date part from a datetime field ctranjith SQL Server 2000 2 October 25th, 2004 06:42 AM
Lose cell Text when editing cell in VSFlexGrid 6 bobcratchet VB How-To 0 July 30th, 2004 09:32 AM





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