+ Reply to Thread
Results 1 to 11 of 11

vba code to replace the column names for those column name "Proposal that starts with "1."

  1. #1
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    vba code to replace the column names for those column name "Proposal that starts with "1."

    I am in need of help to build up a macro that will replace the column names at row 4. I have an excel sheet that looks like the sheet1 in the attached. I need to replace the column names for those column name "Proposal#" that has values 1 and 1.* that starts from row 5. It has to loop columnwise and check for each proposal# and if the value is 1 or 1.* then it should replace. The desired output is in the Sheet2. Can anyone please help me on this.
    Attached Files Attached Files

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Try this code to see if this helps........
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Try this:

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Hi sktneer, i tried your code but it replace all the Proposal# to First Proposal. My requirement was to replace the Proposal# and Votecast for those values with 1.*
    Hi alansidman, i tried your code but it didnot replace the Votecast to First Vote Cast but it did replace Proposal# except the Range Q:S

    Can you help me on this?

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Try this:

    Please Login or Register  to view this content.
    It does not change Columns Q:S because in line 5 they are blank. Your criteria in the first post references row 5 as the source of 1.*

  6. #6
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Ok alansidman, but I need those Proposal# and Vote Cast from Merged Cell "Current Year" to be replaced by First Proposal# and First Vote Cast for which the values is 1 or 1.*. It has to change the columns Q:S even if the line 5 are blank since I would get data that will be blank sometimes. I have attached an updated excel sheet. Your code did not update the Vote Cast. Can you help me?
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Can anyone help me on this?

  8. #8
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Hi, alansidman. I just modified your code but considered only those cells that has 1.* in it and selecting its corresponding offset(0,2) and changing it to "First Vote Cast" But I am still not able to change the columns for the range (Q:S) since its values for the row is blank. Can you provide some help in this.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-24-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: vba code to replace the column names for those column name "Proposal that starts with

    I figured it out myself
    here is the below code that worked.
    Please Login or Register  to view this content.

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Your lateste explanation is confusing. In your new example I do not see a first vote cast. How about explaining what specifically you want and don't want and forget about me chasing down 50+ columns of data trying to figure it out. Be specific as to what you want changed and what criteria would change it.

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: vba code to replace the column names for those column name "Proposal that starts with

    Ok. I see that you have solved it. Good. Been away for the morning.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. replace all defined range names in the sheet that start with "Street" to "Road"
    By matrex in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-04-2016, 08:53 AM
  2. [SOLVED] Replace all BLANK cells in column with header title "Balance" to "0"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2014, 09:25 AM
  3. Macro to copy cells from workbook,where column C is = "num1" AND Column D ="num2"
    By jarious87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2013, 03:30 PM
  4. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  5. Replies: 2
    Last Post: 06-06-2013, 12:45 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