+ Reply to Thread
Results 1 to 11 of 11

Formatting data in VBA excel macro

  1. #1
    Registered User
    Join Date
    08-11-2019
    Location
    Switzerland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    5

    Formatting data in VBA excel macro

    Hello everyone! I am having an issue formatting my Worksheet with VBA mAcro

    I have a data sheet with over 500 companies. Column A is the company names (Rows 2-505). Columns B to S are data of those companies. I Wrote macros so that the data is green or red depending on the numbers.

    Example code for J and L columns

    -----------------------------------------------------
    Please Login or Register  to view this content.
    ---------------------------------------------------------------------

    How can I make it so that the Company Name SHOWS at the last empty column/row (U), IF it has passed (Showed GREEN) in all Previous columns criteria??

    Thank you VERYMUCH in advance.
    Last edited by Appreciate The Help; 08-11-2019 at 12:17 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,806

    Re: Formatting data in VBA excel macro

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. As you are new here, I have done it for you this time.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Formatting data in VBA excel macro

    Hi there !

    Try this way:

    Please Login or Register  to view this content.
    Tell me how that worked out for you.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  4. #4
    Registered User
    Join Date
    08-11-2019
    Location
    Switzerland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    5

    Re: Formatting data in VBA excel macro

    Hey there! thank you for the quick reply. I attempted that and it did not work. I am posting a similar photo so that you may visualize how it appears.Attachment 636780 The name of the company "should" appear int he last Column/Row IF its data was green in the previous columns. Sorry for the inconvenience and Thank you very much!!!!!

  5. #5
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Formatting data in VBA excel macro

    In order for you to upload a file, please Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  6. #6
    Registered User
    Join Date
    08-11-2019
    Location
    Switzerland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    5

    Re: Formatting data in VBA excel macro

    I am having issues uploading the entire file online. My apologies, I realize its much easier with the actual document in front of everyone.

    My intention is to have a code that "If cell.Interior.Color = VBA.ColorConstants.vbGreen throughout row...(if the company Row remains green in all Columns) Then Range ("A") company name, reappears in the final Column/ROw.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,806

    Re: Formatting data in VBA excel macro

    We don't need to see the entire document - just a small cut-down sample copy containing the code and some relevant desensitised data.

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

    Re: Formatting data in VBA excel macro

    How about
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-11-2019
    Location
    Switzerland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    5

    Re: Formatting data in VBA excel macro

    Sorry for the wait. I am attaching a similar version of the sheet (simply chnages the letters of columns), Meanwhile... thank you everyone helping me with the issue, its my first time in a website like this, I appreciate all the hep and feedback!!!

    PS. If you notice Row 5 (company name A) is green throughout the sheet. I would want that name to reappear in the end of the data, so in (K5) The ones that have even 1 red box in the row would not be able to "pass" onto the final column/row. So that in the end, only the Names of full green rows would appear at the end (In column K).

    Sorry I am making so many edits, I am trying to clarify my situation as best I can!
    Attached Files Attached Files
    Last edited by Appreciate The Help; 08-11-2019 at 01:39 PM.

  10. #10
    Registered User
    Join Date
    08-11-2019
    Location
    Switzerland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    5

    Re: Formatting data in VBA excel macro

    Hello! Thank you for posting your code too. I attempted it and it didnt work on my sheet. I posted the code in phases to also help do it in steps. Perhaps I am the one doing something incorrect? Should I practice with Offset and
    "If Flg = 2 Then Range("U" & cell.Row).Value = Range("A" & cell.Row).Value
    Flg = 0"
    I will try different forms of writing that code, it may help. Thanks again!

  11. #11
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Formatting data in VBA excel macro

    What is the expected outcome? And what to do with an equal value?

+ 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. VBA formatting macro that worked in Excel 2010 is not working correctly in Excel 2013
    By jayar2112 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2015, 01:14 PM
  2. [SOLVED] Formatting Data with Macro
    By eguirocker3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2014, 06:00 AM
  3. Replies: 56
    Last Post: 03-11-2014, 03:56 PM
  4. Macro / Add-in for formatting data.
    By lifeisaspreadsheet in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 02-26-2013, 05:29 PM
  5. Data Formatting in Excel/Macro
    By Sadanand Padmawar in forum Excel General
    Replies: 1
    Last Post: 07-18-2006, 02:00 PM
  6. Formatting Data using a macro
    By Steven in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2006, 02:50 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