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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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,214,520
Messages
6,120,007
Members
448,935
Latest member
ijat

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