Results 1 to 13 of 13

dividing data equally between cells VBA

Threaded View

  1. #4
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,425

    Re: dividing data equally between cells VBA

    Sub DivideEqual()
      Dim Arr, i&, Nr&
      Nr = 96                                                  'number of cells
      Arr = Application.Transpose(Sheets("sheet1").Range("J8:J57").Value)  'read your values
      If Nr = 0 Then MsgBox "fatal error", vbCritical: Exit Sub  'do not divide by 0
      For i = 1 To UBound(Arr)
        If IsNumeric(Arr(i)) Then Arr(i) = Application.Round(Arr(i) / Nr, 14) Else Arr(i) = Empty  'divide in a loop by the number of cells if your value is a number
      Next
      Sheets("sheet2").Range("A1").Resize(Nr, UBound(Arr)).Value = Arr  'write to here
    End Sub
    Last edited by bsalv; 01-05-2014 at 08:19 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro which sums up equally colored cells
    By Marina86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2013, 08:40 PM
  2. Excel 2007 : Spreading data equally
    By darkdan21 in forum Excel General
    Replies: 0
    Last Post: 04-06-2012, 07:21 AM
  3. Replies: 5
    Last Post: 02-24-2012, 11:48 AM
  4. Divide cell amounts between cells equally
    By hotwoz in forum Excel General
    Replies: 6
    Last Post: 07-08-2011, 05:54 AM
  5. Replies: 2
    Last Post: 06-14-2007, 05:18 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