+ Reply to Thread
Results 1 to 4 of 4

VBA - Selection.FillRight by a "z" condition

  1. #1
    Registered User
    Join Date
    09-20-2021
    Location
    Brazil
    MS-Off Ver
    10
    Posts
    2

    VBA - Selection.FillRight by a "z" condition

    Hi all, how you doing

    i 'm new to the VBA world and in this forum and I would like to ask for your help, of course if you can.

    I created a "Sub" that should do the following procedure:

    1. Detect the last active row in column A of my spreadsheet;
    2. Still in this row, move the cursor to the column Y;
    3. Enter in a "Do While Loop" to row 13 where:
    It will establish an "IF" and check row by row in column Y if the z condition is True or False. If false it goes up to the next row before the last to the next analysis. If it is true:
    i. Still on the row, the cursor will select the range from column 34 to 36 and will do a "Selection.FillRight", to expand the formulas and formatting;
    ii. Then the same thing between columns 39 to 41;
    iii. Then the same thing between columns 44 through 46;
    iv. Then the same thing between columns 49 to 51;
    4. Enter Loop Finishing procedure on line 13.

    I made this VBA, but I don't understand why it isn't working.

    Below is the attached spreadsheet if you want to analyze:


    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Attached Files Attached Files
    Last edited by 6StringJazzer; 09-24-2021 at 02:44 PM.

  2. #2
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    21,296

    Re: VBA - Selection.FillRight by a "z" condition

    Please explain what "isn't working" means. How do the results differ from what you expect?
    Jeff
    | | |?| |?| |?| |?| | |:| | |?| |?|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    09-20-2021
    Location
    Brazil
    MS-Off Ver
    10
    Posts
    2
    Quote Originally Posted by 6StringJazzer View Post
    Please explain what "isn't working" means. How do the results differ from what you expect?
    Hi 6StringJazzer, thank you.
    What isn't working is the variable UltCel. I don't know why, but every time I try to run this code, the deburg shows up.
    Many thanks!

  4. #4
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    21,296

    Re: VBA - Selection.FillRight by a "z" condition

    You are assigning the value of Select which is -1. You do not want to Select this cell, you want to retrieve its Value.

    Please Login or Register  to view this content.

+ 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: 5
    Last Post: 02-05-2019, 12:03 AM
  2. [SOLVED] Formulas to sum distinct values with condition "any" and "all"
    By HeyInKy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-30-2017, 10:40 PM
  3. Formuals to sum distinct values with condition "any" and "all"
    By HeyInKy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-30-2017, 12:44 PM
  4. [SOLVED] VBscript to stop selection at "-----Original Message-----" plus change ";" in the output
    By 20GT in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2017, 11:46 PM
  5. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  6. [Solved] Macro Column selection keeps defaulting to "C:x" instead of just "x"
    By Cappytano in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2015, 10:33 AM
  7. [SOLVED] Condition Format when Cell Value = "0" but not "BLANK"
    By tuongtu3 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-21-2015, 09: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