Results 1 to 4 of 4

Counting cells in a column to add formulas to that equal number of cells

Threaded View

flipjarg Counting cells in a column to... 07-11-2012, 10:34 AM
StevenM Re: Counting cells in a... 07-11-2012, 11:07 AM
flipjarg Re: Counting cells in a... 07-11-2012, 11:30 AM
StevenM Re: Counting cells in a... 07-11-2012, 11:45 AM
  1. #1
    Registered User
    Join Date
    01-14-2009
    Location
    Earth
    MS-Off Ver
    2007
    Posts
    43

    Counting cells in a column to add formulas to that equal number of cells

    What I am trying to do is count how many cells have data and then drop in formulas in some cells to the right, according to how many cells I have counted as NOT being empty. Attached is a picture that may more clearly explain what I am trying to do.

    There must be a better way to do this... because what I have isn't working this is where my macro is running into problems:

    ...
        ' COUNT THE NUMBER OF CUSTOMERS AND SAVE AS A VARIABLE
        Range("B2").Select
        Do While IsEmpty(ActiveCell.Value) Or ActiveCell.Value = ""
            custCount = custCount + 1
            n = n + 1
            ActiveCell.Offset(1, 0).Select
        Loop
        ' MsgBox "n = " & n & " ..... custCount = " & custCount, vbInformation, "VARIABLES AFTER WHILE LOOP"
        ' MsgBox "C" & custCount, vbInformation, "Test"
        
        ' FILL CARRIER CELLS WITH FORUMLAS AND QUANTITY CELL WITH 1s
        For n = 0 To custCount
            Range("C2", "C" & custCount).Select
            ActiveCell.FormulaR1C1 = "1"
            n = n + 1
        Next n
    Attached Images Attached Images
    Last edited by flipjarg; 07-11-2012 at 11:30 AM. Reason: solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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