Change code to include other targeted cells

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
1,074
Office Version
  1. 2019
Platform
  1. Windows
I have the code below that multiplies the number entered in row 42 by 3.65 (starting from column B). I would like the code to be able to do the same for each cell that I'm currently targeted in row 42. It should not multiply the entire row 42. Only the targeted cell in row 42

Code:
    If Intersect(Target, Range("B42:IV42")) Is Nothing Then Application.EnableEvents = True: Exit Sub
    If Target.Offset(0, -1) = "IBQ Credit Card" Then
        Target.Value = Round(Target.Value * 3.65, 2)
    End If
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hey Av8tordude,
Just to clarify - how exactly would you like your code to work? For example, would you like to select a cell (range of cells), hit a keyboard shortcut, and have these cells multiplied by 3.65?
 
Upvote 0
^^ what he said. Or do you want to utilize the double-click event?
 
Upvote 0
solve my own puzzle....thanks

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    If Intersect(Target, Range("B42:IV42")) Is Nothing Then Application.EnableEvents = True: Exit Sub
    Target.Value = Round(Target.Value * 3.65, 2)
    Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top