Paste special validation

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

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).
 
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 fnd>0 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top