Calculate specific column with VBA

Russk68

Well-known Member
Joined
May 1, 2006
Messages
589
Office Version
  1. 365
Platform
  1. MacOS
Hi all

I want to calculate only column B whenever a change is made in column A.

Thank you!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
If it's directly connected, could you not use a formula for each row ??
Without knowing what calculation is required, a macro would seem like overkill !
 
Upvote 0
Be aware that once triggered, this event macro will leave calculation set to manual.
Code:
Dim R As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set R = Selection.Cells(1, 1)
Application.Calculation = xlCalculationManual
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(R, Target) Is Nothing Then
    If Not Intersect(Target, Range("A:A")) Is Nothing Then
        Range("B:B").Calculate
    End If
End If
End Sub
 
Upvote 0
Hi Michael

The issue that I'm trying to escape, is having the workbook calculate everytime that I make an entry in column A. It takes a couple of seconds after every entry. I'm hoping that if only column B calculates, it will speed up the data entry process. Its a complex workbook and I'm using column A & B as just an example.

Thanks!
 
Upvote 0
Hi Joe
I pasted the code in the worksheet that I'm working on and I got this error.

Compile error:

Ambiguous name detected: Worksheet_Change
 
Upvote 0
The error is because you can't have 2 seperate worksheet_change events.
You will either need to merge the events OR remove one of them
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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