Copy a sheet containing VBA within the same workbook

exsoil

New Member
Joined
Mar 29, 2022
Messages
3
Office Version
  1. 2021
  2. 2007
Platform
  1. Windows
Hi, I am relatively new to excel, forums, and vba code... I am entering and processing data on one worksheet "JNH" and have various reference tables on other worksheets. i want to copy the ("JNH") worsheet and its code multiple times within this workbook. I found all sorts of ways to copy the sheets with vba and otherwise but can't get my macros to work in the new sheets without manually changing all the references. i tried uploading an image of my code and a minisheet. It doesn't look like my macro buttons and text boxes that were giving problems with copying are on the mini sheet. Please let me know what else you need to effectively help me


EXSOIL!test.xltm
ABCDEFGHIJKMNOPQRSTUVWXY
1Farm:Column1Column2Column6Column7
2Date:Liming materials 
3Previous Crop:Vulcan Agri-Lime (Brown) 
4Yield Prev. CropUSA Gypsum (Damp) 
5Unit:Aragonite 
6Crop:Manures 
7Name: Crop goal#REF! 
8Address#REF!Unit:#REF! 
9City/State:#REF!Field:Primary&Secondary Nutrients 
10Date:January 0, 1900Sample /Acres:Soft Rock Phosphate  
11Field: Acres:0Crop: Yield: Lab No.MAP 11-52-0 
12  TEC:DAP 18-46-0 
13Lab ResultspH:Potassium Chloride 0-0-60 
14Lab No: HUMUS %Potassium Sulfate 0-0-50 
15Total Exchange Capacity (TEC)0.00Nitrogen ENR:K-Mag/Sul-Po-Mag 22K,22S,11Mg 
16pH0.00Sulfate S:Magnesium Sulfate 11%Mg 12%S 
17Humus: %0.00Olsen PElemental Sulfur 90% 
18ANIONS (-)Estimated Nitrogen Release from HumusPhosphate:Rock Salt/Sea 90 39%Sodium 
19ENR -- NITROGEN:lbs / acre0Calcium:Chiliean Nitrate 15-0-2 24%Sodium 
20SULFATE - S:p.p.m.0Magnesium:Micro Nutrients 
21P1 or (Olsen) Potassium:Boron 10% 
22PHOSPHATES: (as P2O5) lbs / acre0Sodium:Ferrous Sulfate 30%Fe 12%S 
23CATIONS(+)CALCIUM:lbs / acre0Other Bases:Manganese Sulfate 32%Mn 19%S 
24MAGNESIUM:lbs / acre0Hydrogen:Copper Sulfate 25%Cu 12%S 
25POTASIUM:lbs / acre0Cobalt:Zinc Sulfate 35%Zn 17%S 
26SODIUM:lbs / acre0Salts:Trace Minerals 
27BASE SATURATION PERCENTChlorides:oz. Sodium Molybdate 39% 
28Ca Calcium:} Ca+Mg =80%0.00Boron:oz. Cobalt Sultate 38% 
29MgMagnesium:0.00Iron:Nitrogen Materials 
30KPotasium:0.00Manganese:Protein Meal 13-0-0 
31NaSodium:0.00Copper:Ammonium Sulfate 21-0-0-24S 
32-Other Bases:0.00Zinc:Urea 46-0-0 
33HExchangeable Hydrogen:0.00Moly:gal. UAN 32% 
34-MICRO- NUTRIENTS gal. UAN 28% 
35BBoron:p.p.m.0.00Total:gal. Liquid Fish 3-0.3-0 
36FeIron:p.p.m.0.00Ca + Mg:note 1 
37MnManganese:p.p.m.0.00Ca + Mg+ K:note 2 
38CuCopper:p.p.m.0.00Ca + Mg + K + Na:MANGANESE: 
39ZnZinc:p.p.m.0.00 
40MoMolybdenum:p.p.m.0.00COPPER: 
41CoCobalt:p.p.m.0.00multiple notes 1 
42-Salts:p.p.m.0.00multiple notes 2 
43ClChlorides:p.p.m.0.00multiple notes 3 
44NOTES / COMMENTS ZINC: 
45 
46MOLYBDEMUM: 
47 
48 
49COBALT: 
50 
51NITROGEN: 
52value 1 
53value 2 
54value 3 
55value 4 
56value 5 
57value 6 
58value 7 
59MISC: 
60misc 1 
61misc 2 
62misc 3 
63misc 4 
64misc 5 
JNH
Cell Formulas
RangeFormula
W7:W8W7=#REF!&" "&#REF!
D7D7=PROPER(JNH!T1)
D8:D9D8=PROPER(JNH!#REF!)
D10D10=(JNH!T2)
D11D11=UPPER(JNH!T9)
I11I11=JNH!T10
K11K11=IF(ISTEXT(JNH!T3),UPPER(JNH!T3&" / "&JNH!T6),UPPER(JNH!T6))
Q11Q11=JNH!T7&" "&JNH!T8
I12I12=IF(AND(I11<1,I11>0),I11*43560,"")
J12J12=IF(ISNUMBER(I12),"sq.ft.","")
E14E14=UPPER(JNH!T11)
F15:F17F15=JNH!T12
A18A18="ANIONS (-)"
F19:F20,F22F19=JNH!T15
F21F21=IF(JNH!T17 >0,JNH!T17,"")
F23F23=F15*F28*4
F24F24=F15*F29*2.4
F25F25=F15*F30*7.8
F26F26=F15*F31*4.6
A32,A42,A34A32="-"
F28:F33F28=JNH!T19
S34S34=IF(T12>19.34,"HEAVY CLAY",IF(T12>8.68,"MEDIUM CLAY",IF(T12>5.2,"HEAVY SAND 12-20% Mg",IF(T12>4.15,"SAND 20% Mg",IF(T12>2.77,"LIGHT SAND 200lb. Mg min.",IF(T12>0.1,"EXTREME SAND",""))))))
F35:F40F35=JNH!T28
F41:F43F41=JNH!T25
B44B44=TEXTJOIN(IF(EXACT(Notes_List[Column7],UPPER(Notes_List[Column7])),CHAR(10), CHAR(10)),TRUE,Notes_List[Column7])
Y2:Y64Y2=FILTER([@Column2],ISNUMBER([@Column1]),"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
W10:W11Expression=($B$26>0)textNO
W7Expression=#REF!>0textNO
W8Expression=#REF!>0textNO
T20Cell Valuebetween 1 and 10textNO
T21Expression=$B$30<5textNO
T22Expression=$B$31<0.5textNO
T21Expression=$B$30<3textNO
T12Cell Valuebetween 5.21 and 8.68textNO
T12Cell Valuebetween 4.16 and 5.21textNO
T12Cell Valuebetween 2.78 and 4.15textNO
T12Cell Valuebetween 0.1 and 2.78textNO
T18Expression=($T$17>0)textNO
T17Expression=$T$17>0textNO
D6:G6Cell Valuecontains ""textNO
F22Expression=$F$21textNO
S34:T34Cell Valuecontains "SAND 20% Mg"textNO
S34:T34Cell Valuecontains "HEAVY SAND 12-20% Mg"textNO
S34:T34Cell Valuecontains "LIGHT SAND 200lb. Mg min"textNO
S34:T34Cell Valuecontains "EXTREME SAND"textNO
T19Expression=#REF!<>68textNO
T20Expression=#REF!<>12textNO
V6:V8Expression=#REF!textNO
V9:V40Expression=#REF!textNO
Cells with Data Validation
CellAllowCriteria
T3List=CROP_validation_LIST
T1List=client_validation
W3:W5List=Lime_List
T5Any value
T6List=CROP_validation_LIST
T7Any value
T8List=bu_ton_cwt
Screenshot 2022-03-29 120212.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
select all the module objects in the project window, copy,
move to the new project (workbook), paste.
but this is for other workbooks. Macros work for all sheets in 1 workbook.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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