Check Cells for Real Dates

rhombus4

Well-known Member
Joined
May 26, 2010
Messages
563
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
 

rhombus4

Well-known Member
Joined
May 26, 2010
Messages
563
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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)
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
14,559
Office Version
  1. 365
Platform
  1. Windows
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.
 
Solution

rhombus4

Well-known Member
Joined
May 26, 2010
Messages
563
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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
 

Forum statistics

Threads
1,148,140
Messages
5,745,028
Members
423,917
Latest member
Frank1931

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
Top