ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste special validation (https://www.excelbanter.com/excel-programming/407448-paste-special-validation.html)

Rpettis31

Paste special validation
 
I have a sheet the updates values with a macro. I would like the macro to
verify the date and copy and paste the values on the rows with the current
date only. The current date is listed in one of the cells(1,14).






Mike H.

Paste special validation
 
Sub copyWithValidDateOnly
Dim Z as integer
Dim TheDt as date
Dim Fnd as double
Dim Y as double
Dim DataArray(500,5) as variant
let TheDt = cells(1,14).value
let x=1
Do while true
if cells(x,1).value=empty then exit do 'assumes that if no date in column
1, then
'you'd just jump out of the process.
if cells(x,1).value=TheDt then
Fnd=Fnd+1
for Y=1 to 5
dataarray(fnd,Y)=cells(x,Y).value
Next
end if
x=x+1
Loop

if fnd0 then
windows("writeout.xls").select
'goto the area to write new data (no idea how to tell you to do that)
let Y=activecell.row
for X=1 to Fnd
for Z=1 to 5
cells(y,Z).value=dataarray(x,Z)
next
y=Y+1
Next
end if

End sub

"Rpettis31" wrote:

I have a sheet the updates values with a macro. I would like the macro to
verify the date and copy and paste the values on the rows with the current
date only. The current date is listed in one of the cells(1,14).







All times are GMT +1. The time now is 03:48 AM.

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