DjentChicken
New Member
- Joined
- May 9, 2024
- Messages
- 1
- Office Version
- 2010
- Platform
- Windows
I guess I'm looking to see if this is even possible first, I've put together some VBA code but I'm having issues with it executing. My goal with this code is to take a database table I've compiled and make each row of this table export into a separate workbook template I've created. I need specific cells in the data table row to be pasted into specific cells of my template. For example I need cell A5 from my master table be pasted into D5 of my template workbook. I'm further trying to automate this process by possibly not having to change the code every time I want to export specific rows. I'm not sure if it's possible for a pop up to instruct to select a row/rows for exporting into separate files. I've supplied what code I've been working on below (I won't be surprised if I'm told to scrap it). I've also supplied my master data table "Master Information List" Workbook, as well as the template workbook " Spec Sheet Template". I'd appreciate any and all guidance, I hope something like this is possible.
"Master Information List"
"Spec Sheet Template"
VBA Code:
Option Explicit
Private Sub EntireColumnRange()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim sws As Worksheet: Set sws = wb.Worksheets(1)
'"Tag" (A"#")[master information List] copy/paste -> "Tag Number" (D5) [Spec Sheet template]
wb.sws("Master information List").rg("A5").Copy Destination:=sws("Spec Sheet template").rg("D5").PasteSpecial
'Header (B-F)
ThisWorkbook.Worksheets("Master information List").Range("B5:F5").Copy Destination:=Worksheets("Spec Sheet template").Range("H1:H2, J3, H3:H4")
'Info (G-J)
ThisWorkbook.Worksheets("Master information List").Range("G5:J5").Copy Destination:=Worksheets("Spec Sheet template").Range("D6:D9")
'Body (K-S)
ThisWorkbook.Worksheets("Master information List").Range("K5:S5").Copy Destination:=Worksheets("Spec Sheet template").Range("D10:D18")
'Trim (T-Y)
ThisWorkbook.Worksheets("Master information List").Range("T5:Y5").Copy Destination:=Worksheets("Spec Sheet template").Range("D19:D24")
'Actuator (Z-AF)
ThisWorkbook.Worksheets("Master information List").Range("Z5:AF5").Copy Destination:=Worksheets("Spec Sheet template").Range("D29:D35")
'Accessories (AG-AO)
ThisWorkbook.Worksheets("Master information List").Range("AG5:AO5").Copy Destination:=Worksheets("Spec Sheet template").Range("D40:D48")
'Service (AP-BD)
ThisWorkbook.Worksheets("Master information List").Range("AP5:BD5").Copy Destination:=Worksheets("Spec Sheet template").Range("E52,D52,E53,F53,G53,E54,F54,G54,E55,F55,G55,E56,E57,E58,E59")
'Notes (BE-BH)
ThisWorkbook.Worksheets("Master information List").Range("BE5:BH5").Copy Destination:=Worksheets("Spec Sheet template").Range("C66:C69")
End Sub
"Master Information List"
master list example coding.xlsm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | AD | AE | AF | AG | AH | AI | AJ | AK | AL | AM | AN | AO | AP | AQ | AR | AS | AT | AU | AV | AW | AX | AY | AZ | BA | BB | BC | BD | BE | BF | BG | BH | |||
1 | Tag | Header | Info | Body | Trim | Actuator | Accessories | Service | Notes | |||||||||||||||||||||||||||||||||||||||||||||||||||||
2 | D5 | H1 | H2 | J3 | H3 | h4 | D6 | D7 | D8 | D9 | D10 | D11 | D12 | D13 | D14 | D15 | D16 | D17 | D18 | D19 | D20 | D21 | D22 | D23 | D24 | D29 | D30 | D31 | D32 | D33 | D34 | D35 | D40 | D41 | D42 | D43 | D44 | D45 | D46 | D47 | D48 | E52 | D52 | E53 | F53 | G35 | E54 | F54 | G54 | E55 | F55 | G55 | E56 | E57 | E58 | E59 | C66 | C67 | C68 | C69 | ||
3 | TAG # | PJ #: | P.R. #: | DATE: | By: | Sheet # | PLANT | SERVICE | LINE/VESSEL # | P&ID # | PIPE SIZE / SCH / ID | TYPE | SIZE | MATERIAL | BONNET TYPE / MAT. | END CONNECTION & RATING | BOLTING MATERIAL | BEARINGS / GASKET | PACKING | SIZE | TRIM CHAR. | PLUG/BALL/DISK MAT. | SEAT MAT. | STEM Mat. | LEAKAGE CL. | TYPE OF ACTUATOR | FLOW ACT. | FAIL POS. | SOLENOID ENERGIZE TO | PLANT AIR PRESS MIN & MAX | REGULATOR W/GAUGE | AIR FILTER | SOLENOID VALVE | LIMIT SWITCHES | NEC CLASSIFICATION | HANDWHEEL | POSITION INDICATOR | AIR SET WITH GUAGE | TUBING FITTINGS | SS TAG | PMI | fluid | phase | flow max | flow norm | flow min | temp max | temp norm | temp min | pres. Max | pres. Norm | pres. Min | spec. grav. @ op. | op. viscosity | allow. Deci. | shut off pres. | note 1 | note 2 | note3 | note4 | ||
4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 | ROV-0003 | 08/07/23 | TR | 1 | LLDPE | H2 FROM TRUCK IN HDPE | H2-90854-ABA-2"-N | LLPI-90019 | 2" / SCH 40 | TRUNNION | 2" | WCB (MARINE GRADE PAINT) | WCB (MARINE GRADE PAINT) | 2" x 300# RF | MANUF STD | BY MFR | PTFE | BY MFR | FULL BORE | 304 SS | REINFORCED PTFE WITH METAL CARRIER RING | 304 SS | VI | MANUF STD | OPEN | CLOSE | OPEN | 60 PSI / 120 PSI | ALL METAL CONST. ALUM W/GAUGE | COALESCING/ 10 MICRON / ALL METAL CONSTRUCTURE | ASCO 3 WAY, 24VDC I.S. NEMA 4X | 1 N.O. & 1 N.C. : DRY CONTACT EACH I.S. | CLASS 1 DIV. 2 GRP. B-D | DECLUTCHABLE MANUAL W/ HAND WHEEL | WITH | NON-RELEIF TYPE | PARKER CPI | YES | REQUIRED | H2 | 40 | 21.3 | 65 | 50 | 635 | 480 | 0.009 | <85 | 635 | 1)USE EPOXY PAINT ON ALL C.S. PARTS OF VALVE, ACTUATOR, & HANDWHEEL | 2) VALVE SIZING AND DIMENSIONAL DWG REQUIRED W/QUOTE | 3) MUST MEET API FIRESAFE 607 7TH ED. STANDARDS | ||||||||||
Master information List |
"Spec Sheet Template"
master list example coding.xlsm | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | INSTRUMENT SPECIFICATION | PJ NUMBER: | ||||||||||
2 | ON/OFF VALVE | P.R. NUMBER: | ||||||||||
3 | BY: | DATE: | ||||||||||
4 | SHEET NO. | REV: | ||||||||||
5 | 1 | TAG NUMBER | MEET SPEC YES / NO | EXPLAIN | ||||||||
6 | 2 | PLANT | ||||||||||
7 | 3 | SERVICE | IF | |||||||||
8 | 4 | LINE/VESSEL NUMBER | NO | |||||||||
9 | 5 | P&ID NUMBER | ||||||||||
10 | 5 | BODY | PIPE SIZE / SCH / ID | |||||||||
11 | 6 | TYPE | ||||||||||
12 | 7 | SIZE | ||||||||||
13 | 8 | BODY MATERIAL | ||||||||||
14 | 9 | BONNET TYPE / MATERIAL | ||||||||||
15 | 10 | END CONNECTION & RATING | ||||||||||
16 | 11 | BOLTING MATERIAL | ||||||||||
17 | 12 | BEARINGS / GASKET | ||||||||||
18 | 13 | PACKING | ||||||||||
19 | 14 | TRIM | SIZE | |||||||||
20 | 15 | TRIM CHARACTERISTIC | ||||||||||
21 | 16 | PLUG/BALL/ DISK MATERIAL | ||||||||||
22 | 17 | SEAT MATERIAL | ||||||||||
23 | 18 | STEM MATERIAL | ||||||||||
24 | 19 | LEAKAGE CLASS | ||||||||||
25 | 20 | |||||||||||
26 | 21 | |||||||||||
27 | 22 | |||||||||||
28 | 23 | |||||||||||
29 | 24 | ACTUATOR | TYPE OF ACTUATOR | |||||||||
30 | 25 | FLOW ACTION TO | ||||||||||
31 | 26 | FAIL POSITION | ||||||||||
32 | 27 | SOLENOID ENERGIZE TO | ||||||||||
33 | 28 | PLANT AIR PRESS MIN & MAX | ||||||||||
34 | 29 | REGULATOR W/GAUGE | ||||||||||
35 | 30 | AIR FILTER | ||||||||||
36 | 31 | |||||||||||
37 | 32 | |||||||||||
38 | 33 | |||||||||||
39 | 34 | |||||||||||
40 | 35 | ACCESSORIES | SOLENOID VALVE | |||||||||
41 | 36 | LIMIT SWITCHES | ||||||||||
42 | 37 | NEC CLASSIFICATION | ||||||||||
43 | 38 | HANDWHEEL | ||||||||||
44 | 39 | POSITION INDICATOR | ||||||||||
45 | 40 | AIR SET WITH GUAGE | ||||||||||
46 | 41 | TUBING FITTINGS | ||||||||||
47 | 42 | SS TAG | ||||||||||
48 | 43 | PMI | ||||||||||
49 | 44 | |||||||||||
50 | 45 | |||||||||||
51 | 46 | SERVICE | UNITS | MAXIMUM | NORMAL | MINIMUM | ||||||
52 | 47 | FLUID / PHASE | ||||||||||
53 | 48 | FLOW RATE | LB/HR | |||||||||
54 | 49 | TEMP | DEG F | |||||||||
55 | 50 | PRESSURE | PSIG | |||||||||
56 | 51 | SPEC GRAVITY. @ OPERATION | -- | |||||||||
57 | 52 | OPERATING VISCOSITY | -- | |||||||||
58 | 53 | ALLOWABLE /PREDICTED SOUND | dBA | |||||||||
59 | 54 | SHUT OFF PRESSURE | PSIG | |||||||||
60 | 55 | |||||||||||
61 | 56 | |||||||||||
62 | 57 | |||||||||||
63 | 58 | |||||||||||
64 | 59 | |||||||||||
65 | 60 | |||||||||||
66 | 61 | NOTES | ||||||||||
67 | 62 | |||||||||||
68 | 63 | |||||||||||
69 | 64 | |||||||||||
70 | ||||||||||||
71 | ||||||||||||
72 | ||||||||||||
Spec Sheet template |