Results 1 to 8 of 8

VBA code to divide all cells in a dynamic column by 60

Threaded View

Stan Parker VBA code to divide all cells... 12-29-2019, 09:50 AM
saravnepali Re: VBA code to divide all... 12-29-2019, 09:54 AM
Pepe Le Mokko Re: VBA code to divide all... 12-29-2019, 10:00 AM
Stan Parker Re: VBA code to divide all... 12-29-2019, 10:14 AM
jolivanes Re: VBA code to divide all... 12-29-2019, 11:44 AM
mjr veverka Re: VBA code to divide all... 12-29-2019, 01:06 PM
Stan Parker Re: VBA code to divide all... 12-29-2019, 08:36 PM
mjr veverka Re: VBA code to divide all... 12-29-2019, 08:45 PM
  1. #1
    Registered User
    Join Date
    12-29-2019
    Location
    Australia
    MS-Off Ver
    2012
    Posts
    3

    VBA code to divide all cells in a dynamic column by 60

    Hello eveybody,

    I'm looking to create a VBA button that'll quickly allow me to change the units of a duration variable. I have been able to write the code and get it to run smoothly, however when the number rows in the column changes (e.g. theres a new set of data i need to change the units for. For example 6 sets of data instead of 20) the code tries to divide multiple columns by 60.

    Sub Change_Duration_Unit()
    '
    ' Change_Duration_Unit Macro
    '
        Range("T5").Select
        Selection.Copy
        Range("G8").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide, SkipBlanks _
            :=False, Transpose:=False ****** this is the line of script that is highlighted as the error
        Application.CutCopyMode = False
        Selection.NumberFormat = "0.00"
        Range("G8").Select
        
    End Sub
    Thanks for your help in advance,

    Cheers,

    Stan
    Last edited by Pepe Le Mokko; 12-29-2019 at 10:00 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code to recgonize non-numeric "Left"/start of cell in cells of dynamic column
    By horrockc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2016, 10:19 AM
  2. [SOLVED] Take Cells from one column and divide up in multiple columns
    By robkrouse in forum Excel General
    Replies: 5
    Last Post: 09-01-2016, 11:00 AM
  3. VBA code to divide the last row from column A-J by the last row from column K.
    By psingh2688 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-26-2015, 02:31 PM
  4. [SOLVED] Divide a Cell by the number of populated cells in a column
    By MATU70 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 04-11-2014, 06:49 AM
  5. [SOLVED] Using underscore ("_") with Cells().formula, to divide the code in multiple lines
    By Mayda89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2013, 03:42 PM
  6. [SOLVED] Macro/VB Code to Divide Worksheet into several New Files By Column
    By mabiem in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-30-2013, 12:50 PM
  7. Dynamic Find and Divide
    By biker123456 in forum Excel General
    Replies: 0
    Last Post: 10-26-2009, 06:06 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