+ Reply to Thread
Results 1 to 3 of 3

Hello everyone, I am having difficulty getting macro to write the word "false" in a column

Hybrid View

  1. #1
    Registered User
    Join Date
    09-24-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013 but compatible for 2003 version
    Posts
    2

    Hello everyone, I am having difficulty getting macro to write the word "false" in a column

    I want the user to input a value of how many times they want the word false to be written a certain column. Here is my code so far. I need the variable to correlate with a certain row in a column. If the person needs the word "False" written 545 times in column 12, the loop would no which row to stop at. I am trying to create an input box and here is my code. I am using excel 2013 in compatibility mode for 2003-2007. The client still uses excel 2003. The only time I am able to get the false string to populate the column is with this code:
    Sheets("Sheet2").Cells(1, 12).Value = "Consolidation"
    
                             j = 2
                                            
            Do Until Sheets("Sheet2").Cells(j, 12) = " "
                  Sheets("Sheet2").Cells(j, 12).Value = "FALSE"
                  
                  j = j + 1
                  
                  Loop
    The first row has to be populated with the word "Consolidation". That piece of code works. This code obviously causes a buffer overflow. When I use this code to try and stop the "false" message at row 545, the value does not get written at all to the column
               j = 2
            
            Do Until Sheets("Sheet2").Cells(j, 12) = Sheets("Sheet2").Cells(545, 12)
                  Sheets("Sheet2").Cells(j, 12).Value = "FALSE"
                  
                  j = j + 1
                  
                  Loop
    What code do I need to use in order to get input variable to equal to a row in column 12 and stop the message. I figure I could create integer variable and put in where it says .Cells(number,12) from the input but I think it still would not write the "false" message to the input row. Thanks
    Last edited by vlady; 09-24-2013 at 07:36 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Hello everyone, I am having difficulty getting macro to write the word "false" in a co

    Possibly
    Dim s As Variant
    s = InputBox("Number of Falses")
    
    Range(Cells(2, 12), Cells(s + 1, 12)) = "False"

  3. #3
    Registered User
    Join Date
    09-24-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013 but compatible for 2003 version
    Posts
    2

    Re: Hello everyone, I am having difficulty getting macro to write the word "false" in a co

    Thank that worked!!! Greatly appreciated!!!

+ 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] Set pivot column items "True" vs. "False"
    By franklin_m in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-06-2012, 07:36 PM
  2. Replies: 10
    Last Post: 01-26-2012, 08:26 AM
  3. Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" not working
    By redders in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2011, 03:52 PM
  4. Replies: 5
    Last Post: 10-12-2010, 06:46 AM
  5. Replies: 7
    Last Post: 05-13-2006, 05:02 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