+ Reply to Thread
Results 1 to 7 of 7

Concatenate but only to Certain Cells

  1. #1
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Concatenate but only to Certain Cells

    Hello,

    I have an INI file that im trying to reformat. On Sheet 1 is the current structure of the ini file. I've trying to reformat the variables and to add the name found on the cell in Group Names. I've tried to filter out the cells based on the criteria i need but when i do Autofill to the last cell available on column A it concatenates to the empty rows an the rows that are comments or sections.

    The expected outcome sheet shows how it should look once the macro is done. The format of the variables from #{Test} to {{ Test.Server1 }}. If the original variable has a "." in the name already it gets replaced with "_" as shown on line 6. The comments and the sections do not get anything done to them.

    The Group Names page can vary from 3 to 9 names just depending on the project. But you can see the expected outcome should have a separate column with each Name provided.

    Any suggestions on how to accomplish this?Concatenate Example.xlsx

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

    Question Re: Concatenate but only to Certain Cells


    Hello,

    a bit cumbersome … So Sheet1 column A should be corrected for efficiency …

    Rather than the expected worksheet why not creating directly the .ini file ? (needing an attachment for this expected .ini file …)

  3. #3
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Concatenate but only to Certain Cells

    Thanks for the reply. I updated the sheet to have sheet 1 already formatted without the group names Concatenated. I have over 200 files im looking to format and generate with the new format shown on the expected outcome. A file generated would be the ideal solution one for each group name found on the list. Concatenate Example (1).xlsxOutcome.txt

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

    Cool Try this !


    According to your last attachment, once Sheet1 column A correctly updated - as A2:A3 must be {{ Test.# }} -
    a VBA demonstration as a beginner starter :

    PHP Code: 
    Sub Demo1()
        
    Dim F%, S$, V
            F 
    FreeFile
        With Application
            S 
    Join$(.Transpose(Sheets(1).UsedRange.Columns(1)), vbCrLf)
        For 
    Each V In ['Group Names'!A1].CurrentRegion.Value
            Open ThisWorkbook
    .Path & .PathSeparator " .ini" For Output As #F
            
    Print #F, Replace(S, "#", V);
            
    Close #F
        
    Next
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  5. #5
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Try this !

    So its generating the file and naming it based on the group names but it's not Concatenating the group names to the variable. As shown in the outcome.txt file above.

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

    Arrow Re: Concatenate but only to Certain Cells


    Your bad as it works as expected on my side !

    As I wrote « once Sheet1 column A correctly updated - as A2:A3 must be » … so well read my previous post
    then correct at least Sheet1, concatenating operates according to # character …

  7. #7
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Concatenate but only to Certain Cells

    Wow!! totally misread that.. Thank you Marc..works perfectly!

+ 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] Concatenate specific cells if cells in columns match
    By chrisellis250 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-15-2022, 01:45 PM
  2. Merge cells: concatenate 2 cells to form one text string
    By kris01 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-28-2020, 06:12 AM
  3. Concatenate certain cells based on value/skip blank cells?
    By cicicle in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-01-2019, 03:53 PM
  4. [SOLVED] Concatenate cells, If length is greater then X, Concatenate different cells
    By CB5 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-15-2017, 04:18 PM
  5. [SOLVED] Concatenate multiple cells based on separate identical cells
    By Lolpan in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-27-2016, 11:36 PM
  6. Replies: 2
    Last Post: 04-12-2010, 12:35 PM
  7. Replies: 0
    Last Post: 04-07-2009, 04:42 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