XLA routines: EE_ClearColumnsData

EE_ClearColumnsData clears the data but not the header for a range of columns.
Sub EE_ClearColumnsData(FromCol As Variant, Optional ToCol As Variant) ' http://excelexperts.com/xla-routines-eeClearColumnsData for updates on this routine ' - FromCol and ToCol can either be a column, a letter, a number, or a heading ' calls EE_ClearColumn and puts headings back ' Example ' Age ' 1 ' 40 ' => ' Age ' i.e the data is cleared, heading remains 'http://excelexperts.com/xla-routines-eeClearColumnsData for updates on this routine If Not IsMissing(ToCol) Then If ToCol = "" Then ToCol = FromCol End If Else ToCol = FromCol End If If VarType(ToCol) = vbString Then ToCol = CLng(range(ToCol & "1").Column) End If If VarType(FromCol) = vbString Then FromCol = CLng(range(FromCol & "1").Column) End If Dim i As Long For i = FromCol To ToCol If Cells(1, i) <> "" Then EE_TableGetColumnData(Cells(1, i)).ClearContents End If Next End Sub
»
- Nick's blog
- Login or register to post comments
- 3294 reads
Recent comments
5 years 50 weeks ago
6 years 36 weeks ago
6 years 48 weeks ago
6 years 51 weeks ago
7 years 1 day ago
7 years 5 weeks ago
7 years 13 weeks ago
7 years 14 weeks ago
7 years 14 weeks ago
7 years 14 weeks ago