JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,676
- Office Version
- 365
- Platform
- Windows
I am trying to work with this table in some VBA code:
This code is supposed to reset the # column to zeroes. The first statement works, the second one does not. Why is that?
Is there a statement that will reset the entire column to zero without looping?
Thanks
Lunch log.xlsm | |||||||
---|---|---|---|---|---|---|---|
B | C | D | E | F | |||
4 | Name | # | Last | Freq | Next | ||
5 | Moss, Pete | 1 | 10/04/99 | 0 mo | |||
6 | Bacque, Helen | 3 | 10/21/99 | 1 mo | 11/20/99 | ||
7 | Horne, Henrietta | 1 | 3/03/99 | 6 mo | 8/30/99 | ||
8 | Andertal, Neal | 1 | 4/16/99 | 12 mo | 4/10/00 | ||
9 | Baath, Anita | 1 | 10/14/99 | ||||
Names |
Cell Formulas | ||
---|---|---|
Range | Formula | |
F5:F8 | F5 | =IF(AND([@Freq]>0,MyIsDate([@Last])),[@Last]+([@Freq]*30),"") |
F9 | F9 | =IF([@Freq]>0,[@Last]+([@Freq]*30),"") |
This code is supposed to reset the # column to zeroes. The first statement works, the second one does not. Why is that?
VBA Code:
Const rnTblNames As String = "Names"
Const rnColNum As String = "Names[#]"
Dim NameRows As Long
Dim iName As Variant
NameRows = Range(rnTblNames).rows.Count
For iName = 1 To NameRows
Range(rnTblNames)(iName, colNNum) = 0 'This works
Range(rnColNum)(iName) = 0 'This does not work
Next iName
Is there a statement that will reset the entire column to zero without looping?
Thanks