ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro copy data based on cell formatting and paste special values (https://www.excelbanter.com/excel-programming/434610-macro-copy-data-based-cell-formatting-paste-special-values.html)

Drew

Macro copy data based on cell formatting and paste special values
 
I would like to create a macro that copies data (based on cell formatting) on
one sheet (Qry Data) and pastes this data (paste special values) to the next
available line on another sheet (Audit Data). It is like that rows of data
won't be adjacent, but the column data will always be adjacent.

Does anyone have a macro that could do this?
--
Drew

JLGWhiz[_2_]

Macro copy data based on cell formatting and paste special values
 
your description of what you want to copy leaves a lot of latitude for the
criteria. However, lets assume the formatting is bold font in column A.


Sub cpyBold()
Dim lr As Long, rng As Range, c As Range
Dim sh1 As Worksheet, sh2 As Worksheet
Set sh1 = Sheets("Qry Data")
Set sh2 = Sheets("Audit Data")
lr = sh1.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = sh1.Range("A2:A" & lr)
For Each c In rng
If Not IsEmpty(c) And c.Font.Bold = True Then
c.EntireRow.Copy
x = sh2.Cells(Rows.Count, 1).End(xlUp).Offset(1).Address
sh2.Range(x).PasteSpecial Paste:=xlValues
End If
Next
End Sub




"Drew" wrote in message
...
I would like to create a macro that copies data (based on cell formatting)
on
one sheet (Qry Data) and pastes this data (paste special values) to the
next
available line on another sheet (Audit Data). It is like that rows of
data
won't be adjacent, but the column data will always be adjacent.

Does anyone have a macro that could do this?
--
Drew





All times are GMT +1. The time now is 04:23 AM.

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