VBA code to copy cell value

sunilobo

New Member
Joined
Mar 29, 2021
Messages
10
Office Version
  1. 2010
Platform
  1. Windows
I need help in VBA code to copy cell value from rows of the sheet1 to other worksheets in the same workbook

Sheet1 - A5 to sheet2-F10
Sheet1 - A6 to sheet3-F10
Sheet1 - A7 to sheet4-F10

Thanks in advance
 

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,284
Office Version
  1. 2013
Platform
  1. Windows
So do you mean there is no table with N's & sheets names & the destination F10?
Do you want hard codded all of them?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,284
Office Version
  1. 2013
Platform
  1. Windows
May be
VBA Code:
Sub test1()
    a = Array("B1-001", "B1-002", "B1-101", "B1-102", "B1-201", "B1-202")
    For i = 0 To UBound(a)
        With Sheets(a(i)).Range("F10")
          .Value = Sheets("sheet1").Range("N" & i + 8)
        End With
    Next
End Sub
 

sunilobo

New Member
Joined
Mar 29, 2021
Messages
10
Office Version
  1. 2010
Platform
  1. Windows
Thank you so much it is working now. It is really great help.

I need to convert these worksheets in PDF and save them on my computer do you have a VBA code for it. Thanks for the help again
 

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,284
Office Version
  1. 2013
Platform
  1. Windows
VBA Code:
Sub test1()
    a = Array("B1-001", "B1-002", "B1-101", "B1-102", "B1-201", "B1-202")
    For i = 0 To UBound(a)
        With Sheets(a(i)).Range("F10")
          .Value = Sheets("sheet1").Range("N" & i + 8)
          .Parent.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
                                        "C:\" & a(i) & ".pdf" _
                                        , Quality:=xlQualityStandard, IncludeDocProperties:=True
        End With
    Next
End Sub
This to save PDF's on C Dirve Change "C:\"as you wish
 

sunilobo

New Member
Joined
Mar 29, 2021
Messages
10
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

Thank you, sir. You guys are genius.
 

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,284
Office Version
  1. 2013
Platform
  1. Windows
You are welcome
And thank you for the feedback
Be happy & safe
 

sunilobo

New Member
Joined
Mar 29, 2021
Messages
10
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

You are welcome
And thank you for the feedback
Be happy & safe
You are welcome
And thank you for the feedback
Be happy & safe
I am doing something wrong can you please the path

Sub test1()
a = Array("B1-001", "B1-002", "B1-101", "B1-102", "B1-201", "B1-202")
For i = 0 To UBound(a)
With Sheets(a(i)).Range("F10")
.Value = Sheets("sheet1").Range("N" & i + 8)
.Parent.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"C:\"\Users\sunil\Desktop\Solitude/Billing" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True
End With
Next
End Sub
 

mohadin

Well-known Member
Joined
Mar 22, 2015
Messages
1,284
Office Version
  1. 2013
Platform
  1. Windows
VBA Code:
"C:\Users\sunil\Desktop\Solitude/Billing\" & a(i) & ".pdf"
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,108
Messages
5,768,142
Members
425,458
Latest member
Jaspal1996

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
Top