Ok, so here is what I have going on: I have a linked excel workbook with several sheets. I read and read last night and figured out how to reference the excel cells for use with VBA in Access.
Now what I need to do is take a calculated value (a variable) from Access VBA and put it back into an existing Excel worksheet. I read through this site (601 topics) and my thick head just didn't grasp what I needed to do. I read how to import entire tables into Excel, but I only need one cell and want to use the link.
The name of the workbook is BobDataSheet, the name of the worksheet is Transfers and cell I want to write to is B2 (in the picture below in red color). The name of my linked table in Access is also called Transfers.
The reason I need to copy it back to Excel is that this number gets ran with the Excel Workday function to include holidays and etc that are already functioning under another worksheet. Oh, the write needs to be part of a function I have written in Access (snippet below):
If Me.Need_Repairs.Value = True Then
increase = Me.Repair_Time_Tbox.Value
totaldays = totaldays + increase
End If
increase = 0
'Me.Transfer_Tbox.Value = totaldays
'can set a hidden control the value of total days
' Need to send totaldays to Excel Sheet right here
End Function
Will someone point me in the right direction? This is a whole new area for me. Thanks.
Now what I need to do is take a calculated value (a variable) from Access VBA and put it back into an existing Excel worksheet. I read through this site (601 topics) and my thick head just didn't grasp what I needed to do. I read how to import entire tables into Excel, but I only need one cell and want to use the link.
The name of the workbook is BobDataSheet, the name of the worksheet is Transfers and cell I want to write to is B2 (in the picture below in red color). The name of my linked table in Access is also called Transfers.
BobDateSheet.xls | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Title | Value | |||||
2 | DaysTotal | ||||||
3 | |||||||
Transfers |
The reason I need to copy it back to Excel is that this number gets ran with the Excel Workday function to include holidays and etc that are already functioning under another worksheet. Oh, the write needs to be part of a function I have written in Access (snippet below):
If Me.Need_Repairs.Value = True Then
increase = Me.Repair_Time_Tbox.Value
totaldays = totaldays + increase
End If
increase = 0
'Me.Transfer_Tbox.Value = totaldays
'can set a hidden control the value of total days
' Need to send totaldays to Excel Sheet right here
End Function
Will someone point me in the right direction? This is a whole new area for me. Thanks.