How to refer to another sheet

Romano_odK

Active Member
Joined
Jun 4, 2020
Messages
379
Office Version
  1. 365
Platform
  1. Windows
Good afternoon,

I got this code and it works great, but can I let it look into another sheet. So this line works in my sheet called "Orders" with the table name "Orderregels", but what I now need to have it from a sheet called "Data" and table called "Datatable". The command button is on the sheet "Orders" and I need to get the information from sheet "Data" with table name "Datatable".

Can this be done?

Thank you for your time.



VBA Code:
Fiatteren.Caption = "geen fiat" & Chr(10) & Application.CountIf(Range("Datasheet[Fiat]"), "=N")
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Your code doesn't refer to a table called Orderregels anywhere.

Which column in the Datatable table do you need it to look at?
 
Upvote 0
Your code doesn't refer to a table called Orderregels anywhere.

Which column in the Datatable table do you need it to loo
That column is called "Fiat".
Yes I changed the name a few moments ago, indeed its not in this code.
 
Upvote 0
You need to refer to Sheets("Data").Range("Datatable[Fiat]")
 
Upvote 0
Ok its does not work, any suggestions? This is what I got and I placed it in "ThisWorkBook".

VBA Code:
Private Sub worksheet_change(ByVal target As Range)

Fiatteren.Caption = "geen fiat" & Chr(10) & Application.CountIf(Sheets("Data").Range("Datatable[fiat]"), "=J")

End Sub
 
Upvote 0
You can't put a worksheet_change event in the ThisWorkbook module. It won't do anything. It should be in the code module of the sheet where you want to monitor changes - though you would normally limit it to monitoring a particular range.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,129
Messages
6,123,214
Members
449,091
Latest member
jeremy_bp001

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