+ Reply to Thread
Results 1 to 3 of 3

Need Macro code for Multipilcation a Range with constant value based on condition

  1. #1
    Registered User
    Join Date
    08-14-2018
    Location
    India
    MS-Off Ver
    2016
    Posts
    46

    Need Macro code for Multipilcation a Range with constant value based on condition

    Hello Friends,

    I need macro vba code for following requirement.
    File Name:Test.xlsm

    Column B ("0SALES") needs to be multiply with constant value 100 and store the result in column C ("BW Amount") when we have value 7338 ,8150 in column A("0COMP_CODE"). Rest value need to be copy as it is in column C
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Need Macro code for Multipilcation a Range with constant value based on condition

    Hi
    Try
    Please Login or Register  to view this content.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    08-14-2018
    Location
    India
    MS-Off Ver
    2016
    Posts
    46

    Re: Need Macro code for Multipilcation a Range with constant value based on condition

    Thanks dotchiejack , i will definitely try with your code also.
    I have written following code.

    Dim P As Long
    Dim w As Integer
    P = Range("D" & Rows.Count).End(xlUp).Row

    For Each cel In Range("I1:I" & Cells(Rows.Count, 2).End(3).Row) _
    .SpecialCells(xlCellTypeConstants, 1)
    For w = 2 To P
    If Range("D" & w).Value = 7225 Or Range("D" & w).Value = 7338 Or Range("D" & w).Value = 8150 Or Range("D" & w).Value = 8582 Then
    m = cel * 100
    cel.Value = m
    Else
    cel.Value = cel
    End If
    Next w
    Next

+ 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. VBA code to copy paste a range based on a condition
    By rshnkmr39 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2014, 04:29 AM
  2. [SOLVED] Customize code for a macro that copies three rows to a new workbook based on a condition
    By philips in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-04-2013, 05:55 AM
  3. Macro help: Adding Code to save file or email based on a condition
    By slu2383 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-26-2012, 01:39 PM
  4. [SOLVED] Error 13 - Type Mismatch for my macro code for deleting rows based on condition.
    By Whitenoise1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-19-2012, 07:56 PM
  5. VBA code to select cells, row by row in range, based on condition
    By Vera22 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-31-2012, 11:12 AM
  6. Replies: 6
    Last Post: 02-20-2010, 12:44 AM
  7. Running or bypassing code in a macro based on a certain condition...
    By kenab1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-17-2010, 04:03 PM
  8. [SOLVED] Seting a Constant (via code) when creating a new file based on a template
    By Conan Kelly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2005, 01: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