+ Reply to Thread
Results 1 to 10 of 10

Live and automatic cell insertion based on another cell?

  1. #1
    Registered User
    Join Date
    10-26-2008
    Location
    u.K
    Posts
    21

    Live and automatic cell insertion based on another cell?

    Not sure if this is possible, especially from a "live" perspective but,

    Example;

    I have Column A and Column B

    I manually enter a text string into Column A and Column B automatically enters a text string into the equivalent row's cell based on Column A's entry.

    e.g.

    In Column B cell

    =IF(A1="example","Yes","")

    This works fine but still requires the formula is copied to each row, I'm wondering if there's a way to do this "live" so that as soon as I enter "example" into column A row 1, column B row 1 would auto enter "Yes"

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Live and automatic cell insertion based on another cell?

    Hi,

    You'll need a Sheet Change macro

    Untested but

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    10-26-2008
    Location
    u.K
    Posts
    21

    Re: Live and automatic cell insertion based on another cell?

    Thank you, worked perfectly. I've never worked with VB in excel before but based on your answer, researched and voila. If I wanted to extend the change to multiple cells with the same outcome how would I extend the formula, I assume it would be better doing it that way versus writing a separate VB code for another cell.

    e.g.

    Exactly as above but the outcome changes both column B and C to "Yes"

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Live and automatic cell insertion based on another cell?

    Hi,

    Glad you found the earlier stuff useful. Try:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-08-2015
    Location
    manila, Philippines
    MS-Off Ver
    2010
    Posts
    4

    Re: Live and automatic cell insertion based on another cell?

    Have a similar problem.

    I am new to VBA coding and still have a lot to learn. have watched several video tutorial at youtube and tried to make my own userform.

    example:

    Column
    D E F G H I J
    10 8 10 7 6 6 2

    Column L

    (sum)
    (highest possible score:70)

    49


    Column K

    (HPS/total score)
    (% score)

    70


    Column M

    (column K*30%)
    (weighted Score)

    21



    But, so far, i have manage to create (on SHEET1) the ADD, update, find next, find previous buttons and delete button but I am having trouble with column K, L & M. what i want to do is to be able to reflect those on my userform and dynamically update it self in real time whenever i try to update column D,E,F,G,H,I,J is it possible?

    also, I'M stuck on creating a search function for a specific Employee Code. whenever i try to write the macro it always give me a run-time error 424.

    please help with this and Thank you in advance.
    Last edited by bong14; 05-08-2015 at 05:04 AM. Reason: for better readability

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Live and automatic cell insertion based on another cell?

    Hi and welcome to the forum. Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

  7. #7
    Registered User
    Join Date
    10-26-2008
    Location
    u.K
    Posts
    21

    Re: Live and automatic cell insertion based on another cell?

    Many thanks, worked perfectly. To slightly further this, again by keeping it within the same formula, is it possible to added an additional output?

    So, taking the last example

    If Column A = "example" then column B,C = "yes"

    AND

    column D = "No"

    I'm attempting it now but any help appreciated.

  8. #8
    Registered User
    Join Date
    10-26-2008
    Location
    u.K
    Posts
    21

    Re: Live and automatic cell insertion based on another cell?

    Just to answer my own question, was simple in the end. Just add another line

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect (Target, Range("A:A")) Is Nothing Then
    If LCase(Target) = "example" Then Range(Target.Cells(1,2),Target.Cells(1,3) = "Yes"
    Target.Cells(1, 43) = "Online"

    End If


    End Sub

    Column 3 changes to "Yes" and column 43 changes to "Online if the conditions are met.

    Trying to understand how the case works, with LCase and UCase, I added another formula, but it won't change and I believe it's because the conditional word has an upper case SECOND letter, e.g. hEllo. Rather than change, the casing (which isn't appropriate) I'm trying to establish how it to check without case sensitivity

  9. #9
    Registered User
    Join Date
    10-26-2008
    Location
    u.K
    Posts
    21

    Re: Live and automatic cell insertion based on another cell?

    Answer my own question, priot to the sub routine for the above, in the (General) (Declarations)

    Add

    Option Compare Text

    this will make it insensitive to capitalization, bare in mind it will apply to any subs in the code.

    My next query, if anyone can help, as I try to figure it myself.

    Based on the above but this time I'm entering a number string that is formatted as text, and based on that i want to enter a text string in another column. My issue is, it won't recognise a number value (even if it's formatted as text) as a text string.

    E.g,

    If Not Intersect(Target, Range("AI:AI")) Is Nothing Then
    If LCase(Target) = "533" Then Target.Cells(1, 34) = "Credit Card"

    End If

    I can't reformat the column because it contains both text and numbers, so all the number entries are formatted as text. A further issue maybe that some of the numbers start with "0" which, when formatted as text removes the "0" so "0533" becomes "533", i'm not sure if the issue which the proposed code lies within that or it's just naother thing to counter

    I'm wondering if I could use Select Case to change the entry? I've been using this to color code cells and rows depending on a columns entry with great success, just unsure on whether it can be used for text entries.

  10. #10
    Registered User
    Join Date
    05-19-2011
    Location
    Pakistan
    MS-Off Ver
    Excel 2016
    Posts
    28

    Re: Live and automatic cell insertion based on another cell?

    sorry
    this command is not working when adding further rows like
    If LCase(Target) = "example" Then Target.Cells(1,2) = "Yes"
    If LCase(Target) = "example2" Then Target.Cells(1,2) = "No"
    .....
    ....
    ....
    ....
    etc

+ 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. Replies: 1
    Last Post: 12-29-2014, 01:45 PM
  2. Automatic data insertion
    By pewe in forum Excel General
    Replies: 8
    Last Post: 12-01-2011, 06:14 PM
  3. Automatic Row Insertion with Cell Values
    By abhinavk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2011, 07:14 PM
  4. Automatic Row insertion
    By collinsc in forum Excel General
    Replies: 3
    Last Post: 05-30-2009, 07:27 PM
  5. Automatic copying of Cell Contents & insertion of new worksheets
    By honeydew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2008, 12:00 AM

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