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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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