• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Turn any cell into an interactive button Help fix one problem

i would really appreciate if someone tells me.

  • what i did wrong if i did.

    Votes: 0 0.0%
  • what will fix it.

    Votes: 0 0.0%

  • Total voters
    0

kalua1231

Member
Please someone help me fix this issue it is giving me error,
Run-time error '1004':

application-defined or object-defined error
code below this line. Thanks again
-----------------------------------------------------------------------------------------------
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Dim dccolumn As Integer
Dim dcvalue As String

dccolumn = ActiveCell.Column
dcvalue = ActiveCell.Value

If Application.Intersect(ActiveCell, [headers]) Is Nothing Then

If ActiveCell.Value <> "" Then

ActiveSheet.Range("a:j5000").AutoFilter Field:=dccolumn, Criterial:=dcvalue

End If

End If

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim rownumber As Integer

rownumber = ActiveCell.Row

If Application.Intersect(ActiveCell, [headers]) Is Nothing Then

If ActiveCell.Value <> "" Then

Range("a4:j5000").Interior.ColorIndex = xlNone

Range("a" & rownumber & ":j" & rownumber).Interior.Color = RGB(255, 255, 9)

End If

End If

End Sub
 
Hi ,

The Range keyword requires a worksheet range reference which includes a column reference and a row reference.

I do not know whether this is what you have in your code , but if it is , then the following is an error :

ActiveSheet.Range("a:j5000").AutoFilter Field:=dccolumn, Criterial:=dcvalue

Change it to :

ActiveSheet.Range("a4:j5000").AutoFilter Field:=dccolumn, Criterial:=dcvalue

Narayan
 
Hi ,

Your Excel table ends at row 58. Your range for autofiltering cannot extend beyond that.

Instead of using a range use a ListObject , so that you need not specify a range.

Change the code to :

Me.ListObjects(1).Range.AutoFilter Field:=dccolumn, Criteria1:=dcvalue

Narayan
 
quick question if i want to add another name that is not to include the word i have clicked but others where should i add it.

Hope it makes sense
 
Hi ,

Sorry , but I have not understood.

Can you give more details of what you mean by add a name ?

I have no idea what your workbook does , so you will have to be more descriptive.

Narayan
 
(This code works like this) For example: i have clicked on BUSSINESS it will only show me BUSSINESS if i click on CLASS it will only show me CLASS.

Is there's a way that when i click on BUSSINESS to sort it out in a different Column and to add other (title) beside BUSSINESS to it. thank you.
 
Back
Top