copy and paste by using formula with help of VBA

santoshloka

Board Regular
Joined
Aug 31, 2017
Messages
125
i have some data in A5 TO H500 in photos sheet ,which i want to copy them in gallery sheet in same location,this code need some modifiaction

Sub INPUTDATA()
Worksheets("photos").Activate
Range("A5").Select
ActiveCell.FormulaR1C1 = "=IF('gallery'!RC="""","""",'gallery'!RC)"
Range("A5").Select
Selection.Copy
Range("B5:H5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A5:H5").Select
Selection.AutoFill Destination:=Range("A5:H500")
Range("A5:H500").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Font.Bold = False
Worksheets("photos").Activate
End Sub
 

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).
Code:
 Sheets("photos").Range("A5:H500").Value = "=IF('gallery'!RC="""","""",'gallery'!RC)"
 Sheets("gallery").Range("A5:H500").Value = Sheets("photos").Range("A5:H500").Value
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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