Macro will only work in the file where I created it

LouiseZ

New Member
Joined
Apr 7, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have created a macro (my first ever), and it works nicely in the workbook where it was created. However, I get the same kind of data several times a week and that data is imported into a new workbook, and I'd like to use the macro I created to calculate some things in the new workbooks. Whenever I try, it says "Runtime error 9" and when I define this it says "Identifier under cursor is not recognized". I have watched several tutorial videos etc. but I just can't figure out what the problem is...
Can someone please help? Below is a snapshot of a part of the code, I assume the yellow part is where the problem is, but I don't know where the problem lies. I don't want the macro tied to a particular workbook because then I'd have to make a new one for each workbook, and that removes the whole idea of it - so I understand that there must be a solution to this?

Very grateful for any help!

1617802994594.png
 
Can you perhaps edit two dataset files in Notepad, replacing sensitive information with nonsense and deleting all but -say- five rows of data? Please upload that to somewhere and share a link here and also show how you want the end result to look like.
https://liuonline-my.sharepoint.com...dEhjcTLnFrUesBzOJG6Qtl-mM60E1mLqxXPw?e=jdCp0Y (how I want it to look)
"Original" file.

What I am trying to accomplish is to divide analysis with isotype, to get the ratio between the two. However, I want this to be for each gate, so for example I want the gate (flow cytometry talk) CD163 by itself and I want all the analysis that has the gate CD163 divided by all the isotype for CD163. Then I want this for my 5 different gates, and I would love to have the result put into a new sheet next to the "original" sheet. The data points that I want to look at is under the column called X-Med, the rest doesn't matter in this case. So I want all the X-Med data from the analysis divided by isotype, sorted by gate. Does that make sense?

I hope you can access. I saw that the data look distorted in Notepad but once I copied it back into Excel to check, it looked okay again.

Your help is much appreciated!
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,520
Messages
6,120,016
Members
448,936
Latest member
almerpogi

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