Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
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 August 4th, 2016, 04:41 AM
Registered User
 
Join Date: Aug 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA deleting single digits only

Hello all
I am trying to delete numbers from a list. Problem is, if for example I want to delete just '6', it will also delete the 6 from 46. How can I get around this?
This is some part of my code

Code:
If CheckBox1 = True Then
    Word = "1"

    Selection.Replace What:=Word, Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
End If

If CheckBox2 = True Then
    Word = "2"

    Selection.Replace What:=Word, Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
            ReplaceFormat:=False
End If
Does any one know how to get around this ? Thank you !
 
Old August 4th, 2016, 06:05 AM
Authorized User
 
Join Date: Oct 2015
Posts: 48
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Hi.
I thing it has to do with LookAt = xlPart.it needs to be xlWhole.
__________________
Nostalgia 4 Infinity
 
Old August 4th, 2016, 06:08 AM
Registered User
 
Join Date: Aug 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey!
I tried that as well but it doesn't work either





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL subquery VBA recordset single table Inner Join not supported pthegr8 Access VBA 6 January 19th, 2014 06:47 PM
Retrieving a single value from a single column in a single row? Ron Howerton LINQ 2 May 17th, 2011 08:46 AM
Mulitplication of two digits in Datagrid [email protected] Visual Studio 2005 0 June 10th, 2008 03:35 PM
deleting or replacing a single element hasdy XSLT 3 March 14th, 2006 12:28 PM
Number of Digits Colonel Angus Javascript How-To 3 December 1st, 2004 09:12 AM





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