ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Paste Special Value using Code over Several Worksheets (https://www.excelbanter.com/excel-programming/295419-copy-paste-special-value-using-code-over-several-worksheets.html)

John[_81_]

Copy Paste Special Value using Code over Several Worksheets
 

I want to copy paste special values that I have based on looking up a date
(in C.O.S H4) and then pasting and copying directly in the same sell over
various worksheets, startng in worksheet Sales. The value in C.O.S H4 that I
am looking for in each worksheet might not always be in Column A

I've managed to do this for one worksheet but can't seem to do it for more
than one How can I join several of these codes together?

The code I'm using and works great for just one area is

Public Sub SetupDatabase()
Dim wsSheet As Worksheet
Dim dTest As Double
dTest = Worksheets("C.O.S").Range("H4").Value
For Each wsSheet In Sheets(Array("Sales"))
With wsSheet
For Each rCell In .Range("A3:A" & .Range("A" &
Rows.Count).End(xlUp).Row)
If rCell.Value = dTest Then
With rCell.Offset(0, 1).Resize(, 26)
.Value = .Value



End With
End If
Next rCell
End With
Next wsSheet

End Sub



BrianB

Copy Paste Special Value using Code over Several Worksheets
 
For Each wsSheet In ActiveWorkBook.Worksheets ...

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 09:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com