+ Reply to Thread
Results 1 to 7 of 7

Help with setting Column Range to remove string with VBA

  1. #1
    Registered User
    Join Date
    08-31-2013
    Location
    N/A
    MS-Off Ver
    Excel 2003
    Posts
    14

    Help with setting Column Range to remove string with VBA

    Greetings all, I'm having an issue with the following code. Based on the debug, it's an issue with the Set Range line but I'm not sure what I'm doing wrong.

    Thanks in advance for the assistance!!!

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Help with setting Column Range to remove string with VBA

    Mate,
    Range.Column would return a column number, not a Range; so delete the .columns(1) part in your set statement. Simple enter the range of which you would like to perform this word check/replacement.
    It should work fine.

  3. #3
    Registered User
    Join Date
    08-31-2013
    Location
    N/A
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with setting Column Range to remove string with VBA

    Hi Jewelsharma,

    Thanks for the prompt response.

    I deleted as you said and I still get prompted for a debug with the following line highlighted.

    Please Login or Register  to view this content.
    Any thoughts?

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Help with setting Column Range to remove string with VBA

    Make these changes......

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2012
    Location
    Melbourne, VIC
    MS-Off Ver
    Excel 2016
    Posts
    750

    Re: Help with setting Column Range to remove string with VBA

    Thanks sktneer!
    Sorry I missed that.

    Hi isritter,
    as "Range" is a keyword in VBA code, it cannot be used to name a variable. So "Dim Range as Range" is an incorrect declaration. Make the changes as advised by sktneer and your code should work just fine.

    Cheers!

  6. #6
    Registered User
    Join Date
    08-31-2013
    Location
    N/A
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with setting Column Range to remove string with VBA

    jewelsharma and sktneer, thanks a million. Your wisdom has assisted me greatly!

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Help with setting Column Range to remove string with VBA

    Glad to help you. Thanks for the feedback.
    Since you are new to forum, just to tell you that if that takes care of your question, please mark your thread as solve. To do so click on Thread Tools (just above your first post) --> Mark thread as solved.
    Moreover you may also click on * (star) to Add Reputation to those who have put their time and efforts to help you in this forum. This is another way to say thanks to them.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Setting the address in a named range to a string in VBA
    By OldManExcellor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2014, 09:56 AM
  2. [SOLVED] ListBox Column and Range setting
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2013, 12:02 PM
  3. Modify to Run On Specific Column and Remove trailing digits in string
    By pmterp in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-12-2012, 07:47 PM
  4. Replies: 11
    Last Post: 02-22-2011, 07:07 PM
  5. Setting a column range
    By CFryer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-13-2009, 04:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1