View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
clmarquez[_7_] clmarquez[_7_] is offline
external usenet poster
 
Posts: 1
Default Need help resolving error in defining last row


Help...inexperienced Excel VB programmer at work...

I can't seem to figure out why my code below generates an error at the
"LastCol" definition line. Can anyone help me out? Thanks!

Also, as you can probably tell from the code, I am wanting to clear
cells in the range that contain certain text - is there a simpler way
to do this, rather than having each separate If/EndIf section?


Dim DataTable As Range
Dim LastRow As Long
Dim LastCol As Long

Application.ScreenUpdating = False
Sheets("Training Record").Select
ActiveSheet.Outline.ShowLevels RowLevels:=2, ColumnLevels:=2
LastRow = Range("A10").End(xlDown).Row
LastCol = Range("K1").End(x1toright).Column
Set DataTable = Range("K10", cells(LastRow & LastCol))

For Each cell In DataTable
If cell.Value = "a/r" Then
cell.ClearContents
End If

If cell.Value = "core" Then
cell.ClearContents
End If

If cell.Value = "inv" Then
cell.ClearContents
End If

If cell.Value = "opt" Then
cell.ClearContents
End If

Next


--
clmarquez
------------------------------------------------------------------------
clmarquez's Profile: http://www.excelforum.com/member.php...o&userid=29386
View this thread: http://www.excelforum.com/showthread...hreadid=494767