+ Reply to Thread
Results 1 to 8 of 8

Text in a cell is not remaining when inserting a line with VBA

  1. #1
    Registered User
    Join Date
    11-23-2019
    Location
    Madrid
    MS-Off Ver
    2016
    Posts
    12

    Text in a cell is not remaining when inserting a line with VBA

    Hello,

    I,m adding a cell with a macro and with the line I want to add some specific text in some cells. The A column works fine as the date is added but in the Column J the text "en marcha" remains only for the added line. When the new line is added the Text is gone. Any idea how to improve code and solve the issue?

    Thank you in advance!
    Tavi
    Attached Images Attached Images

  2. #2
    Valued Forum Contributor
    Join Date
    06-02-2012
    Location
    London, England
    MS-Off Ver
    365
    Posts
    397

    Re: Text in a cell is not remaining when inserting a line with VBA

    Could you attach the workbook rather than a picture of it?
    Far easier to help if we can see it in context.

    Beth.

  3. #3
    Registered User
    Join Date
    11-23-2019
    Location
    Madrid
    MS-Off Ver
    2016
    Posts
    12

    Re: Text in a cell is not remaining when inserting a line with VBA

    Quote Originally Posted by BanginMyHeadOnMyDesk View Post
    Could you attach the workbook rather than a picture of it?
    Far easier to help if we can see it in context.

    Beth.
    of course. Here it is. Thx
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Text in a cell is not remaining when inserting a line with VBA

    When you insert a new line it's triggering the change event, which then calls macro 1, which in turns clears col J

  5. #5
    Registered User
    Join Date
    11-23-2019
    Location
    Madrid
    MS-Off Ver
    2016
    Posts
    12

    Re: Text in a cell is not remaining when inserting a line with VBA

    Quote Originally Posted by Fluff13 View Post
    When you insert a new line it's triggering the change event, which then calls macro 1, which in turns clears col J
    pffff, now I get it. Thx...

  6. #6
    Valued Forum Contributor
    Join Date
    06-02-2012
    Location
    London, England
    MS-Off Ver
    365
    Posts
    397

    Re: Text in a cell is not remaining when inserting a line with VBA

    Try this:
    Please Login or Register  to view this content.
    The 'Application.EnableEvents' lines will temporarily stop the change event from firing when you insert the new line.

    Beth.

  7. #7
    Registered User
    Join Date
    11-23-2019
    Location
    Madrid
    MS-Off Ver
    2016
    Posts
    12

    Re: Text in a cell is not remaining when inserting a line with VBA

    Quote Originally Posted by BanginMyHeadOnMyDesk View Post
    Try this:
    Please Login or Register  to view this content.
    The 'Application.EnableEvents' lines will temporarily stop the change event from firing when you insert the new line.

    Beth.
    This is so nice, Thank you Beth

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Text in a cell is not remaining when inserting a line with VBA

    Another option, is you can prevent the change event from running if more than one cell is selected like
    Please Login or Register  to view this content.

+ 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] From Cell A2, remove text that is found in Cell B2, and display any remaining text in C2
    By lespaulfan#1 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-13-2019, 12:42 PM
  2. [SOLVED] Macro Assistance - inserting cell & data line by line not by column
    By Toxicca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2015, 09:26 AM
  3. [SOLVED] Remove Text from Cell with Mixed Characters, Sum Remaining Numbers
    By eugeniusjr in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-28-2013, 12:08 AM
  4. Inserting a Value From Another Cell Into a Line of Text
    By jereshaw in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-02-2013, 07:18 AM
  5. [SOLVED] I want cell A1 to equal $A$2 even after inserting line at A2
    By adamb2000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-28-2006, 07:25 PM
  6. inserting an additional line of text within same cell
    By knet22 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-16-2006, 09:10 PM
  7. [SOLVED] Inserting line breaks into merged text cells.
    By MrSafetyNeedshelp in forum Excel General
    Replies: 1
    Last Post: 08-11-2005, 06:05 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