Check Cells for Real Dates

rhombus4

Well-known Member
Joined
May 26, 2010
Messages
586
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Whats the easiest way to check if a cell is a valid date before doing something else

Need to Check A7, C7 L7 and Z7 if any are either text or incorrect date entries exit sub with a message box

Thanks
 
When D2 changes new data is passed onto the sheet z1 gives target row when clicked on, so when I select a row I can copy a row of data. Just wanted to check dates i.e a7, c7, l7 and z7 if row 7 was selected

I already have a few lines if code when D2 changes.
How many not intersect targets can you have.

Ideally I wanted it in the module code I was doing earlier it worked for 2 ranges not 3 or 4
I.e this works
VBA Code:
For each c in range("A" and rownum, "C" & rownum)

But when I tried below I got compile error wrong number of arguments or invalid property assignmen

VBA Code:
For each c in range("A" & rownum, "C" & rownum, "L" & rownum)
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Using that method, the commas need to be inside the double quotes
VBA Code:
For each c in range("A" & rownum & ",C" & rownum & ",L" & rownum)

Commas inside the quotes for non continuous ranges.

Commas outside the quotes for a continuous range (maximum of 2 ranges specified), Range("A1","L1") is the same as Range("A1:L1") but is a bit easier to write when using a variable as the row.
 
Upvote 0
Solution
Thanks again. Didn't realise Range("A1","L1") is the same as Range("A1:L1")
Never seen it like that, just "A1, b1, c1" etc
 
Upvote 0

Forum statistics

Threads
1,214,893
Messages
6,122,121
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top