+ Reply to Thread
Results 1 to 9 of 9

Copy only certain tex within a single cell

  1. #1
    Registered User
    Join Date
    12-20-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    6

    Copy only certain tex within a single cell

    Hello,

    I am trying to figure out how to make a macro only copy a string of text within a cell. Luckily, it should be able to run on an easy rule. I need it to only copy everything after a ":", so I have in cell A1...

    ABCD1234: Apples and Oranges

    I want it to copy to only "Apples and Oranges" and paste it in cell B1.


    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Copy only certain tex within a single cell

    why do you need a macro. A formula will quite happily do this.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Copy only certain tex within a single cell

    As a formula:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Copy only certain tex within a single cell

    As Macro:

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy only certain tex within a single cell

    Maybe:

    Please Login or Register  to view this content.
    Or you could just use the formula in Range("B1")

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Copy only certain tex within a single cell

    Hi, Zenderboy01,

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  7. #7
    Registered User
    Join Date
    12-20-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Copy only certain tex within a single cell

    Holger,

    The second line of code works perfect. However, I am trying to modify it by using referential code instead of hard code, but I keep getting the "Range of object" error and I can't figure out why. I have..

    Dim curRow As Integer
    Dim curCol As Integer

    curRow = 4
    curCol = 3

    Range(Cells(curRow, curCol + 2)).Value = Trim(Split(Range("A1").Value, ":")(1))

    Any idea why this error occurs when I replace it with variables?

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Copy only certain tex within a single cell

    Hi, Zenderboy01,

    Range with Cells within awaits two Cells mentioned, just use Cells alone:
    Please Login or Register  to view this content.
    And please use Code-Tags when showing your procedure.

    Ciao,
    Holger

  9. #9
    Registered User
    Join Date
    12-20-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Copy only certain tex within a single cell

    Ah! I knew it would be something so simple. Thanks! Sorry for not using code tags, I'm a noob to VBA and using forums.

+ 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. [SOLVED] How to subtract single cells with double digits into a single digit of a single cell.
    By greenfox74 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-11-2021, 02:05 AM
  2. [SOLVED] what am i doing wrong?, VBA copy merged cell to single cell and back again
    By rmharrison in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2013, 06:45 PM
  3. Replies: 3
    Last Post: 01-22-2006, 05:30 PM
  4. VBA copy from single to merged cell.
    By goober in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2005, 11:35 PM
  5. [SOLVED] How do I copy Tab into a single cell in Excel?
    By bryantebbe in forum Excel General
    Replies: 3
    Last Post: 01-19-2005, 09:06 PM

Tags for this Thread

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