ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba: How do I write a "For Each Statement" nested in a "With Statement"? (https://www.excelbanter.com/excel-programming/316093-vba-how-do-i-write-each-statement-nested-statement.html)

Mcasteel[_30_]

vba: How do I write a "For Each Statement" nested in a "With Statement"?
 

Dim strReportDate As String
strReportDate = InputBox("Please Enter Report Date:", "Get Dail
Report:")

Dim dtReportDate As Date
dtReportDate = DateValue(Date:=strReportDate

--
Mcastee
-----------------------------------------------------------------------
Mcasteel's Profile: http://www.excelforum.com/member.php...fo&userid=1569
View this thread: http://www.excelforum.com/showthread.php?threadid=27639


Frank Kabel

How do I write a "For Each Statement" nested in a "With Statement"?
 
Hi
then your statement can't work. you may try something along the lines
'...
Dim cell as range
for each cell in rng
if cell.value=dtReportDate then
'do something
end if
next
'...

--
Regards
Frank Kabel
Frankfurt, Germany

"Mcasteel" schrieb im
Newsbeitrag ...

Dim strReportDate As String
strReportDate = InputBox("Please Enter Report Date:", "Get Daily
Report:")

Dim dtReportDate As Date
dtReportDate = DateValue(Date:=strReportDate)


--
Mcasteel
---------------------------------------------------------------------

---
Mcasteel's Profile:

http://www.excelforum.com/member.php...o&userid=15698
View this thread:

http://www.excelforum.com/showthread...hreadid=276390




All times are GMT +1. The time now is 12:23 PM.

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