VBA to Capture Cell Value

jarett

Board Regular
Joined
Apr 12, 2021
Messages
179
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Trying to write a VBA script to capture the value in cell J2 each time we open the file, I would want to record the value in J2 in the rows below and maybe also record the date in the "I" column next to that value. Each time the file is opened it refreshes. I only got to the very first part of the VBA code, haven't found anything else on the web to help finish it off if its possible.
VBA Code:
Private Sub Workbook_Open()
Range("J3") = Range("J2").Value

End Sub
Order_Line_Fill_Rate.xlsx
ABCDEFGHIJ
1ItemCodeItemCodeDescWarehouseCodeQuantityOrderedQuantityBackorderedUDF_QTY_PULLEDUDF_INVENTORIED_ITEMTotal LinesBO LinesLine Fill %
21332L1332L TIG WELDING GLOVE CUT RE0004800Y149833078%
31332L1332L TIG WELDING GLOVE CUT RE00084084Y
410019063-GRAY-XLRMNS FR SLD VENT LS WRK SHRT SI000505Y
5CDKW038-NAVYBLUE20 oz. Viking Nova Tumbler00048480Y
610022599-GRAY-LGRMNS FR AIR HENLEY LS TOP SILVR000303Y
710012552-BLUE-3230MNS FR M4 RLX BSC BOOT CUT JEA000303Y
810012552-BLUE-4032MNS FR M4 RLX BSC BOOT CUT JEA000505Y
910019063-GRAY-XXLRMNS FR SLD VENT LS WRK SHRT SI000505Y
10SHE01-5000-ICE GREY-3XLGildan Heavy Cotton T-Shirt LE000505Y
11FQD810-10QUATRO DIELECTRIC REGULAR BOOT000101Y
12SHENHK01-G2XL-V3XL-R3XLSHELTON NEW HIRE KIT GLOVE 2XL000101Y
13FR44-YELLOW-3XLSealtex Flame FR Hi-Vis 50in C000101Y
Order_Fill_Rate
Cell Formulas
RangeFormula
H2H2=COUNTA(A:A)
I2I2=COUNTIF(E:E,"> 0")
J2J2=ABS((I2-H2)/H2)
Named Ranges
NameRefers ToCells
ExternalData_1=Order_Fill_Rate!$A$1:$G$1498H2
 
Found I had the code in the sheet and didn't have the module tied to "This Workbook"
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I was going to ask about that, but it was in the workbook_open event in the OP. Glad you got it sorted out.
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
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