Run time error 1004: Application defined or object defined error

m_a_advisoryforall

New Member
Joined
May 15, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Good afternoon everyone!

I am currently rebuilding a CRM system from the internet. Right now I am working on the part which is supposed to load the contacts from one range to another when selected (as shown on the screenshot). This is where I run into problems. I get following error displayed:

Error: Run-time error 1004: Application-defined or object-defined error

Code:
Sub Contact_Load()
Dim ContRow As Long, ContCol As Long
With Sheet1

.Range("B13").Value = True 'Set Contact load to True
ContRow = .Range("B12").Value 'Contact Row

For ContCol = 14 To 17
.Range(.Cells(36, ContCol).Value).Value = .Cells(ContRow, ContCol).Value 'Contact details

Next ContCol
.Range("B13").Value = False 'Set contact load to false
End With
End Sub


Excel shows that the error is supposed to be in the yellow marked line.

Also here is the link to the video of the CRM-system I am rebuilding:

I appreciate every help. Many thanks in advance!
Screenshot (5).png
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
May I suggest that you use code tags (vba button on posting toolbar) and paste your code within the tags? This will keep everything properly indented, assuming it is to begin with. Then use a comment to ID the problem line, like this:
VBA Code:
Sub Contact_Load()
Dim ContRow As Long, ContCol As Long

With Sheet1
    .Range("B13").Value = True 'Set Contact load to True << this line raises the posted error
    ContRow = .Range("B12").Value 'Contact Row
    For ContCol = 14 To 17
        .Range(.Cells(36, ContCol).Value).Value = .Cells(ContRow, ContCol).Value 'Contact details
    Next ContCol
    .Range("B13").Value = False 'Set contact load to false
End With

End Sub
1004 has umpteen different messages and causes, most of them cryptic (IMO). That line does not err for me, but your .Range line in the loop does. All I can think of is that your cell is formatted in a way that won't accept TRUE, which looks like a boolean value to me, because you're not using "TRUE", which is text. Perhaps check the cell format or use "True" or use numeric values for T/F, which are 0 and -1 respectively.
 
Upvote 0

Forum statistics

Threads
1,217,188
Messages
6,135,092
Members
449,911
Latest member
Omarahmed99

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top