sheet observation , columns D and E ,H , V find last cells used then clear any format and contents of the last cell IN VBA
sheet observation , columns D and E ,H , V find last cells used then clear any format and contents of the last cell IN VBA
![]()
Dim cols as Variant Dim i as Long Dim r as String cols = Array("D", "E", "H", "V") For c = LBound(cols) to UBound(cols) Worksheets("observations").Range(c & Rows.Count).End(xlUp).Clear Next c
Last edited by buran; 06-29-2017 at 07:06 AM.
If you are pleased with a member's answer then use the Star icon to rate it.
Perhaps...Using buran's code....
Edited...Or![]()
Option Explicit Sub JEAN1972() Dim cols As Variant Dim c As Long, lrow As Long cols = Array("D", "E", "H", "V") With Sheets("observations") For c = LBound(cols) To UBound(cols) lrow = .Cells(Rows.Count, cols(c)).End(xlUp).Row .Range(cols(c) & lrow).ClearContents Next c End With End Sub
![]()
Option Explicit Sub JEAN1972() Dim cols As Variant Dim c As Long cols = Array("D", "E", "H", "V") With Sheets("observations") For c = LBound(cols) To UBound(cols) .Range(cols(c) & Rows.Count).End(xlUp).ClearContents Next c End With End Sub
Last edited by Sintek; 06-28-2017 at 12:47 PM.
Good Luck...
I don't presume to know what I am doing, however, just like you, I too started somewhere...
One-day, One-problem at a time!!!
If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
Also....Add a comment if you like!!!!
And remember...Mark Thread as Solved...
Excel Forum Rocks!!!
Buran & Sintek
Thank you , an insight how to remove the cell borders linestyle from the last cell with the above code
Pleasure glad I could help...thanks for rep...
an insight how to remove the cell borders linestyle from the last cell with the above code![]()
Option Explicit Sub JEAN1972() Dim cols As Variant Dim c As Long cols = Array("D", "E", "H", "V") With Sheets("observations") For c = LBound(cols) To UBound(cols) With .Range(cols(c) & Rows.Count).End(xlUp) .ClearContents .Borders.LineStyle = xlLineStyleNone End With Next c End With End Sub
of course, there should be no brackets:
sorry for he mistake and thanks for rep![]()
Worksheets("observations").Range(c & Rows.Count).End(xlUp).Clear
@ buran
Perhaps
.Range(cols(c) & Rows.Count).End(xlUp).ClearContents
![]()
Dim i as Long ' c as long
Yes, right. I have to stop for a moment and go for a coffee break :-)
Last edited by buran; 06-29-2017 at 07:39 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks