+ Reply to Thread
Results 1 to 11 of 11

Want to create macro multiply with above number then move to next celll and same repeated.

Hybrid View

singh1982jeetuu Want to create macro multiply... 06-26-2014, 05:14 AM
XOR LX Re: Want to create macro... 06-26-2014, 05:18 AM
mohan.pandey87 Re: Want to create macro... 06-26-2014, 05:23 AM
singh1982jeetuu Re: Want to create macro... 06-26-2014, 05:28 AM
mohan.pandey87 Re: Want to create macro... 06-26-2014, 05:31 AM
singh1982jeetuu Re: Want to create macro... 06-26-2014, 05:22 AM
singh1982jeetuu Re: Want to create macro... 06-26-2014, 05:35 AM
mohan.pandey87 Re: Want to create macro... 06-26-2014, 05:42 AM
singh1982jeetuu Re: Want to create macro... 06-26-2014, 05:46 AM
mohan.pandey87 Re: Want to create macro... 06-26-2014, 05:50 AM
singh1982jeetuu Re: Want to create macro... 06-26-2014, 06:01 AM
  1. #1
    Registered User
    Join Date
    06-26-2014
    Location
    gurgaon
    MS-Off Ver
    7
    Posts
    16

    Want to create macro multiply with above number then move to next celll and same repeated.

    5 6 7 8
    25
    36
    49
    64

    Macro.png
    Last edited by singh1982jeetuu; 06-26-2014 at 05:18 AM.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Want to create macro multiply with above number then move to next celll and same repea

    Hi,

    It's not clear in which cells your values are. Can you please clarify?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    09-17-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Want to create macro multiply with above number then move to next celll and same repea

    Try this:

    Sub LMP_Test()
    
        Dim lngCountValues                  As Long
        Dim rngRangeToApplyMultiply         As Range
        Dim rngEachCell                     As Range
    
        Set rngRangeToApplyMultiply = Range("A1:M1")
        
        lngCountValues = 0
        For Each rngEachCell In rngRangeToApplyMultiply
            lngCountValues = lngCountValues + 1
            rngEachCell.Offset(lngCountValues).Value = rngEachCell ^ 2
        Next rngEachCell
    
    End Sub

  4. #4
    Registered User
    Join Date
    06-26-2014
    Location
    gurgaon
    MS-Off Ver
    7
    Posts
    16

    Re: Want to create macro multiply with above number then move to next celll and same repea

    thanks.

    but issue is if RANGE does not define.

  5. #5
    Registered User
    Join Date
    09-17-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Want to create macro multiply with above number then move to next celll and same repea

    If you will not define any range then how would programe know from which cell it has to start or which one is the last cell.

  6. #6
    Registered User
    Join Date
    06-26-2014
    Location
    gurgaon
    MS-Off Ver
    7
    Posts
    16

    Re: Want to create macro multiply with above number then move to next celll and same repea

    like 5,6,7,8 in columns

    and we want the result on below

    ag: A1=5
    A2=5*5=25

    B1=6
    B3=6*6=36


    C1=7
    C4=7*7=47

  7. #7
    Registered User
    Join Date
    06-26-2014
    Location
    gurgaon
    MS-Off Ver
    7
    Posts
    16

    Re: Want to create macro multiply with above number then move to next celll and same repea

    that i understand by if I the range given (A1:Z1) and i have data on row only (A1:J1) so macro will give the result correctly on A1:J1 but for rest it will run useless.

  8. #8
    Registered User
    Join Date
    09-17-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Want to create macro multiply with above number then move to next celll and same repea

    If you have data in Range A1:J1 then why you are providing Range A1:Z1.

  9. #9
    Registered User
    Join Date
    06-26-2014
    Location
    gurgaon
    MS-Off Ver
    7
    Posts
    16

    Re: Want to create macro multiply with above number then move to next celll and same repea

    its depend some time data in 5 line some data is 7 line.

    or you can create a text box where I can enter the range.

  10. #10
    Registered User
    Join Date
    09-17-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Want to create macro multiply with above number then move to next celll and same repea

    Somthing like this:

    Sub LMP_Test()
        
        Dim lngCountValues                  As Long
        Dim rngRangeToApplyMultiply         As Range
        Dim rngEachCell                     As Range
    
        On Error Resume Next
        Set rngRangeToApplyMultiply = Application.InputBox("Select Range to apply data multiplication:-", "Data Range", , , , , , 8)
        On Error GoTo 0: Err.Clear
        
        If Not rngRangeToApplyMultiply Is Nothing Then
            lngCountValues = 0
            For Each rngEachCell In rngRangeToApplyMultiply
                lngCountValues = lngCountValues + 1
                rngEachCell.Offset(lngCountValues).Value = rngEachCell ^ 2
            Next rngEachCell
        End If
        
    End Sub

  11. #11
    Registered User
    Join Date
    06-26-2014
    Location
    gurgaon
    MS-Off Ver
    7
    Posts
    16

    Re: Want to create macro multiply with above number then move to next celll and same repea

    Great Sir thanks a lot it is superb...

+ 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. Macro to multiply entire row by a fix given number
    By buchumang in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2014, 04:33 PM
  2. Macro to create unique id from email address and assign to repeated entries
    By capson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2014, 11:26 PM
  3. Create Macro to move values from the current sheet in which the macro is activated
    By Turkish1801 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2013, 06:11 PM
  4. Create Folders and Move Files Using VBA/MACRO
    By cjconnor24 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2010, 07:20 PM
  5. [SOLVED] Move data in repeated sets of coluns
    By Sabba B in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-23-2006, 01:10 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