Excel 2016 & 2021 VBA trying to open workbook based on Sheet 7 cell D3

CrashOD

Board Regular
Joined
Feb 5, 2019
Messages
118
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
' To load work book based on cell value
' Real Estate Books
Dim varCellvalueReal As String
'Filename:=Sheets("Sheet1").Range("A2").Value & "\" & Sheets("Sheet2").Range("A2").Value)
varCellvalueReal = Workbook(Filename:=Sheets("Sheet7").Range("D3").Value) ' & "\" & Sheets("Sheet2").Range("A2").Value)
' Personal Books
'Dim varCellvaluePer As String
varCellvaluePer = Range.Worksheet(7, ("D3"))




strFromDate = txtFromDate.Value
strToDate = txtToDate.Value

aFromDate = Split(strFromDate, "/")
aToDate = Split(strToDate, "/")

dtFromDate = DateSerial(aFromDate(2), aFromDate(0), aFromDate(1))
dtToDate = DateSerial(aToDate(2), aToDate(0), aToDate(1))
dtCheckDate = dtFromDate

Application.Interactive = False

Set oReportWorkbook = ActiveWorkbook
Set oReportWorksheet = ActiveSheet

' To Open WOrkbooks
Set oWorkbook1 = Workbooks.Open(varCellvaluePer)
Set oWorkbook2 = Workbooks.Open(varCellvalueReal)



Sheet7
ECT - Report_V1_3-1-test.xlsm
ABCDEFG
1LocationFileJoined
2RealD:\Country&LocalReport\2022 - ECT - Real Estate.xlsxD:\Country&LocalReport\2022 - ECT - Real Estate.xlsx
3PersonalD:\Country&LocalReport\2022 - ECT - C&L - Personal.xlsmD:\Country&LocalReport\2022 - ECT - C&L - Personal.xlsm
4Rows7000
Report Location
Cell Formulas
RangeFormula
D2:D3D2=CONCATENATE(B2,C2)
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

had my answer but thanks !
 
Upvote 0
' To load work book based on cell value
' Real Estate Books
varCellvalueReal = Trim(LTrim(Cells(2, "D").Value)) '1 is rownumber A is the column, read address from A1
' Personal Books
'Dim varCellvaluePer As String
'varCellvaluePer = Range.Worksheet(7, ("D3"))
varCellvaluePer = Trim(LTrim(Cells(3, "D").Value)) '1 is rownumber A is the column, read address from A1

lol so messed up. how do i get it to read from Sheet7 cell D2
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,681
Members
449,116
Latest member
HypnoFant

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