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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,215,334
Messages
6,124,321
Members
449,154
Latest member
pollardxlsm

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