can you advise on code path please

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,731
Office Version
  1. 2007
Platform
  1. Windows
Hi,
Could you advise the code for the following please,i will then continue from there with the others i need to do.

I will add this to a button to transfer cell vales to my end of month sheet.

Worksheet called INCOME1
Copy cell value E32 & paste to Worksheet path shown below,

C,USERS,IAN,DESKTOP,EBAY,ACCOUNTS,PREVIOUS ACCOUNTS,2018 - 2019,SUMMARY 2018 - 2019,SHEET1, then cell E49

Thanks
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
HAve you tried
Code:
"C\USERS\IAN\DESKTOP\EBAY\ACCOUNTS\PREVIOUS ACCOUNTS\2018 - 2019\SUMMARY 2018 - 2019" & SHEET1!E49.value
 
Upvote 0
Hi,
I was looking for the vba code to copy the value then paste the value using the info above.
This will then be put on a button.
 
Upvote 0
Something like the below but stuck on the paste part of the code.

Code:
Private Sub CommandButton1_Click()Dim Answer As Long
Answer = MsgBox("Transfer To Summary Sheet?", vbYesNo + vbInformation, "End Of Month Accounts")
If Answer = vbYes Then


Sheets("INCOME1").Range("E32").Copy Sheets("Sheet1").Range("E49")


ActiveWorkbook.Save
End If


End Sub
 
Last edited:
Upvote 0
This gives me a run time error 9,subscript out of range.

Code:
Private Sub CommandButton2_Click()Dim Answer As Long
Answer = MsgBox("Transfer Values To Summary Sheet ?", vbYesNo + vbInformation, "End Of Month Accounts")
If Answer = vbYes Then


Sheets("INCOME1").Range("E32").Copy Sheets("C:\Users\Ian\Desktop\EBAY\ACCOUNTS\PREVIOUS ACCOUNTS\2018 - 2019\SUMMARY 2018 - 2019").Range("E49")
ActiveWorkbook.Save
End If
End Sub
 
Upvote 0
Code:
Private Sub CommandButton2_Click()
    Dim Answer As Long
    Dim path As String
    path = "C\USERS\IAN\DESKTOP\EBAY\ACCOUNTS\PREVIOUS ACCOUNTS\2018 - 2019\SUMMARY 2018 - 2019" & Sheet1!E49.Value
    Answer = MsgBox("Transfer Values To Summary Sheet ?", vbYesNo + vbInformation, "End Of Month Accounts")
    If Answer = vbYes Then
        Sheets("INCOME1").Range("E32").Copy path
        ActiveWorkbook.Save
    End If
End Sub
 
Upvote 0
Hi,
I get a run time error 438, object doesnt support this property or method.
This is then shown in yellow.

Code:
path = "C\Users\Ian\Desktop\EBAY\ACCOUNTS\PREVIOUS ACCOUNTS\2018 - 2019\SUMMARY 2018 - 2019" & Sheet1!E49.Value
 
Upvote 0
As opposed to the long path name can the workbook name just be used ??
 
Upvote 0
Yup!

Here is amended code

Option Explicit


Code:
Private Sub CommandButton2_Click()
    Dim Answer As Long
    Dim path As String
    path = "C\USERS\IAN\DESKTOP\EBAY\ACCOUNTS\PREVIOUS ACCOUNTS\2018 - 2019\SUMMARY 2018 - 2019\"
    Answer = MsgBox("Transfer Values To Summary Sheet ?", vbYesNo + vbInformation, "End Of Month Accounts")
    If Answer = vbYes Then
        Sheets("INCOME1").Range("E32").Copy path & Sheets("Sheet1").Range("E49")
        ActiveWorkbook.Save
    End If
End Sub
 
Last edited:
Upvote 0
Hi,
Run time error 9 subscript out of range.
I have checked the path many times and its correct.

This is shown in yellow when i debug.

Code:
Sheets("INCOME1").Range("E32").Copy path & Sheets("Sheet1").Range("E49")
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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