+ Reply to Thread
Results 1 to 8 of 8

calculating a row with loop function not working

  1. #1
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    calculating a row with loop function not working

    I am trying to get this macro to multiply the number found in the 14th colomn by a fixed number (in this case 0.9) if the word renewal features in the 6th colomn (referred to as colomn "F" in the code)

    here is what i have so far

    Please Login or Register  to view this content.
    I get a method range of object global failed error in the code in bold above.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: calculating a row with loop function not working

    try just cells(l,7) and cells(l,14)
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    09-17-2013
    Location
    East
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: calculating a row with loop function not working

    try:

    Please Login or Register  to view this content.
    I recommend renaming L to small l. Better coding style.

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: calculating a row with loop function not working

    i ran

    For i = 5 To 1 Step -1

    If Cells(i, 2) = "b" Then
    Cells(i, 4).Value = Cells(i, 3).Value * 0.9
    End If

    Next i

    and it worked ok.

  5. #5
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: calculating a row with loop function not working

    I get a type mismatch on your recommended code

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: calculating a row with loop function not working

    try cdbl(Cells(L, 14).Value) * 0.9

  7. #7
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: calculating a row with loop function not working

    another method of range failure agian

  8. #8
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: calculating a row with loop function not working

    try it for yourselves?
    Attached Files Attached Files

+ 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] Loop for calculating the sales for a given area and a commodity
    By crr.potluri in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-14-2013, 11:44 PM
  2. [SOLVED] Do while loop not working
    By rikkyshh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 01:47 PM
  3. Macro loop Problem (Calculating persons age)
    By PRodgers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2009, 10:02 AM
  4. [SOLVED] Why is this Do Loop not working right?
    By evilrtc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-21-2007, 01:52 AM
  5. Loop not working!!
    By Simon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2005, 12:05 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