+ Reply to Thread
Results 1 to 5 of 5

Update row/columns based on another column's data VBA

  1. #1
    Registered User
    Join Date
    06-27-2020
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    50

    Update row/columns based on another column's data VBA

    Hi All,

    I want to transfer all the id numbers from Data Sheet (column B6:B10000) to the Cover Sheet row #5, if the id is not exist in data sheet (row #5), then extend the formulas in C6:C10 until end of the data in row 5
    For Example, the id numbers in the Data Sheet is from 1 to 15 so, I want to update my Cover Sheet with another 8 id numbers (8-15), and the expected result would be same like in the ?Expected result? Sheet.

    I have attached the file.
    Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi, try this !


    According to your attachment and to the Macro Recorder an Excel basics VBA demonstration as a beginner starter :

    PHP Code: 
    Sub Demo1()
        
    Dim L&
            
    = [Data!B5].End(xlDown)
        
    With [Cover!C5].CurrentRegion.Columns
            
    If .Cells(.Count) < L Then .Item(.Count).AutoFill .Item(.Count).Resize(, - .Count 1)
        
    End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Registered User
    Join Date
    06-27-2020
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    50

    Re: Hi, try this !

    it's working as expected, thank you Marc L

  4. #4
    Registered User
    Join Date
    06-27-2020
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    50

    Re: Hi, try this !

    Hi Marc L,

    Can you please help with the attached sample, the VBA is not working after adding some columns and data in row #4.

    Thank you in advance.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Update row/columns based on another column's data VBA


    As the expected result has not the same layout than the Cover worksheet so do you want

    1. the expected result in another worksheet ?

    2. Delete the Cover worksheet columns C to K and clear row #4 ?

    3. Attach a better workbook well reflecting your need !

+ 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: 3
    Last Post: 10-19-2022, 12:45 PM
  2. [SOLVED] how to update column based on conditions in 2 other columns
    By sj_2022 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-31-2022, 04:14 PM
  3. Auto-Update Data Columns based on Index
    By susigan in forum Excel General
    Replies: 2
    Last Post: 07-13-2020, 08:56 PM
  4. [SOLVED] Update column based on 2 columns in another workbook
    By Lana74 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-11-2019, 06:25 PM
  5. Data Update Based on Column Value
    By sathishkm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-01-2018, 11:55 AM
  6. Replies: 1
    Last Post: 09-30-2014, 07:15 AM
  7. Excel 2007 : Update Columns based on periodic data
    By zitu708 in forum Excel General
    Replies: 3
    Last Post: 04-29-2010, 11:19 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