Hello All,

iam an intermediate user of VBA i love to automate, 
iam struck in on of my code when iam using to fetch data from my excel 
sheet based on todays date and same thing copied after last rows.
it is working but in last all copied cells goes empty..

here is my code please suggest.


Sub todayinterview()

Dim lr As Long
Dim myrow() As Variant
Dim mydata() As Variant

With ActiveSheet
       lr = .Cells(.Rows.count, "A").End(xlUp).Row
    End With

Cells(lr + 2, 3) = "=countif(x:x,Today())"
' (this is to count how many occurrence of today's date)

mydcnt = Cells(lr + 2, 3).Value 

mycellnum = mydcnt * 6    '  if there is 2 rows with todays date and i need 
data from 6 coloumns than mydcnt*6

ReDim myrow(mydcnt)
ReDim mydata(mycellnum)

Dim mycol(1 To 6) As Variant
'For a = 1 To 6
 '  this is to get only specific data from row

mycol(1) = 3
mycol(2) = 4
mycol(3) = 5
mycol(4) = 6
mycol(5) = 24
mycol(6) = 25

'(also please help to cycle this array after last number reached)



For i = 1 To lr
For j = 1 To mydcnt
For k = 1 To mycellnum
For m = 1 To 6
For n = 3 To 9


If Cells(i, 24) = Date Then
myrow(j) = Cells(i, 24).Row
'MsgBox myrow(j)
mydata(k) = Cells(myrow(j), mycol(m))
Cells(lr + 7, n) = mydata(k)
Cells(lr + 3 + j, 3) = myrow(j)

'MsgBox mydata(k)
End If


Next n
Next m
Next k
Next j
Next i


'For n = 1 To mycellnum

'Cells(lr + 7, n) = mydata(n)

'Next n

MsgBox mydata(4)

End Sub

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to