98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Runtime error '1004' application-defined or object-defined error
Runtime error '1004' application-defined or object-defined error
Resolved · Low Priority · Version 2007
Emma has attended:
Access Introduction course
Runtime error '1004' application-defined or object-defined error
Hi there,
I have written a macro to hide specified columns according to a dropdown box selection. The code itself is doing what I want it to do but when it reaches the end of the code the above error comes up and highlights a line of code. I have put my code below and have commented on the line where the error is. Has anybody got any idea how to sort it out?
Sub Hide_Columns()
Dim rowNum As Variant
Dim ColNum As Variant
Dim currcell As Range
rowNum = ActiveCell.Row
ColNum = ActiveCell.Column
Set currcell = ActiveSheet.Cells(rowNum, ColNum)
Do Until currcell.Value = " "
If currcell = Range("a4") Then
currcell.Select
Selection.EntireColumn.Hidden = True
End If
ColNum = ColNum + 1
' Line below has the error
Set currcell = ActiveSheet.Cells(rowNum, ColNum)
' Line above has the error
Loop
End Sub
This my first attempt at VBA so please bear in mind when responding.
Thank you!
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Adjusting the Elevation and Rotation in a 3-D ChartFor any 3-D chart you create, you can adjust the chart |