R
ryguy7272
I am using a UserForm to upload some data to an Excel file saved on a LAN.
The file will grow substantially in size, and as such, it will take a
considerable amount of time to open the File, make the changes, and then
close the file. Is there any way that I can make the changes to the ‘closed’
file on the LAN?
Code here:
Private Sub CommandButton1_Click()
Cells(12, 9) = TextBox1.Text
Cells(12, 10) = TextBox2.Text
Cells(12, 11) = TextBox3.Text
Cells(13, 9) = TextBox4.Text
Cells(13, 10) = TextBox5.Text
Cells(13, 11) = TextBox6.Text
Cells(14, 9) = TextBox7.Text
Cells(14, 10) = TextBox8.Text
Cells(14, 11) = TextBox9.Text
'Sub SaveValuesToNetworkFile()
Dim p As String
Dim f As String
Dim s As String
Dim r As String
Dim ws As Worksheet
p = "\\fsrv3\luna\public\Ryan\"
f = "Destination.xls"
s = "Sheet1"
r = "I12:K14"
Set ws = ActiveSheet
Workbooks.Open (p & f)
' copy range values from current worksheet to same range in network file
ws.Range(r).Copy Workbooks(f).Worksheets(s).Range(r)
' close network file, saving changes
Workbooks(f).Close True
UserForm1.Hide
End Sub
Thanks very much!!
Ryan---
The file will grow substantially in size, and as such, it will take a
considerable amount of time to open the File, make the changes, and then
close the file. Is there any way that I can make the changes to the ‘closed’
file on the LAN?
Code here:
Private Sub CommandButton1_Click()
Cells(12, 9) = TextBox1.Text
Cells(12, 10) = TextBox2.Text
Cells(12, 11) = TextBox3.Text
Cells(13, 9) = TextBox4.Text
Cells(13, 10) = TextBox5.Text
Cells(13, 11) = TextBox6.Text
Cells(14, 9) = TextBox7.Text
Cells(14, 10) = TextBox8.Text
Cells(14, 11) = TextBox9.Text
'Sub SaveValuesToNetworkFile()
Dim p As String
Dim f As String
Dim s As String
Dim r As String
Dim ws As Worksheet
p = "\\fsrv3\luna\public\Ryan\"
f = "Destination.xls"
s = "Sheet1"
r = "I12:K14"
Set ws = ActiveSheet
Workbooks.Open (p & f)
' copy range values from current worksheet to same range in network file
ws.Range(r).Copy Workbooks(f).Worksheets(s).Range(r)
' close network file, saving changes
Workbooks(f).Close True
UserForm1.Hide
End Sub
Thanks very much!!
Ryan---