PDA

View Full Version : Run-time error 438: Object doesn't support this property or method



Yvan
05-28-2018, 03:42 PM
Hi all Im trying to clear multiple range and im getting this run-time error 438 and not sure how to fix it could someone help
Please.

Here is my code

Sub Clearticket()

Range("B6:B11,I6:I9,B13:F14,B16:F17,H13:K31,A34,A14,A17").Select
Selection.ClearContents '<-------error on this line
InsertFormul
ActiveSheet.Range("K3").Select
ActiveCell.Value = Date

End Sub

Paul_Hossler
05-28-2018, 06:08 PM
1. I added CODE tags to your post - you can use the [#] icon and paste the macro between them to format it

2. I had no problem once I commented out the InsertFormul line which didn't compile

3. You can operate on objects with out selecting them




Option Explicit
Sub Clearticket()
Range("B6:B11,I6:I9,B13:F14,B16:F17,H13:K31,A34,A14,A17").ClearContents
ActiveSheet.Range("K3").Value = Date
End Sub

Yvan
05-28-2018, 09:19 PM
1. I added CODE tags to your post - you can use the [#] icon and paste the macro between them to format it

2. I had no problem once I commented out the InsertFormul line which didn't compile

3. You can operate on objects with out selecting them




Option Explicit
Sub Clearticket()
Range("B6:B11,I6:I9,B13:F14,B16:F17,H13:K31,A34,A14,A17").ClearContents
ActiveSheet.Range("K3").Value = Date
End Sub



Thanks all works now