conditional copy of column to another column of same worksheet

S

sanju

Hi,

Please can anyone assist in my requiremnet which is as
I need to copy content of column 32, row 3 onwards to any column
between column 33 to column 256, containning current date.
Column 33 to 256, row 2 , contain dates of all the coming days.
If I am running it today(17-Apr-10), column 32 (AF) ROW 3 onwards
should be copied to any column AI, row 3 onwards.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
COLUMNS AF AH AI
AJ ............................................
IV
Row 1 details blank
row2 16-apr-10 17-apr-10 18-
apr-10...............................................
18-JUL-10
ROW3 Peter
row4 Joy
Row 5 Smith
Row6 kallis
-------------------------------------------------------------------------------------------------------------------------------------------------------------
My earlier code is not working on all the columns, donot know why ?
==========================================================
Sub vert()
Dim lc As Long, sh As Worksheet, rng As Range
Dim lr As Long, cRng As Range
Set sh = ActiveSheet
lc = sh.Cells(2, Columns.Count).End(xlToLeft).Column
Set rng = sh.Range("C31", sh.Cells(2, lc))
lr = sh.Cells(Rows.Count, 32).End(xlUp).Row
Set cRng = sh.Range(sh.Cells(3, 32), Cells(lr, 32))
For Each c In rng
If c = Date Then
cRng.Copy c.Offset(1, 0)
End If
Next
End Sub
============================================
Regards
sanjay
 

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

Top