Why error?

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
Hello, could someone help me here? :)

PHP:
Workbooks.Open "G:\Klienkladd\Behandlingsavdelingen\1_Felles maler\Teamarbeid(Jenskladd)\Teamarbei.xls
If (Workbooks("Pasientliste".Sheet("Ark3").Cell("A7")=
Workbooks("Teamarbeid").Sheet("Ark3").Cell("25")) _
Then Range("A7:D7,F7:T7").Select
Range"F7").Actice
Selection.ClearContents
Else: Application.Run (Teamarbeid!Pas1) _
And Range("A7:D7,F7:T7").Select
Range"F7").Actice
Selection.ClearContents
End If


Does anyone know whats going on here?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
This will compile but I haven't tried to run it:

Code:
    Workbooks.Open "G:\Klienkladd\Behandlingsavdelingen\1_Felles maler\Teamarbeid(Jenskladd)\Teamarbei.xls"
    If Workbooks("Pasientliste").Sheets("Ark3").Cells("A7").Value = Workbooks("Teamarbeid").Sheets("Ark3").Cells("25").Value Then
        Range("A7:D7,F7:T7").Select
        Range("F7").Activate
        Selection.ClearContents
    Else
        Application.Run "Teamarbeid!Pas1"
        Range("A7:D7,F7:T7").Select
        Range("F7").Activatee
        Selection.ClearContents
    End If
 
Upvote 0

par60056

Well-known Member
Joined
Jul 26, 2012
Messages
1,581
Office Version
  1. 2011
  2. 2010
Platform
  1. Windows
  2. MacOS
for 1 thing you are missing a closing quote on the first line. I would have thought the editor would have added it for you.
 
Upvote 0

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
Thanks so much guys, im still new to VBA so its great to learn.
I've changed the code. However i Now get the Type mismatch, runtime run time error 13. I've asked Google, however not geting much more clever.

The cell values are tekst, names like Jack White...

I know the question is a bit off topic, but again: Do you know whats going on now?
 
Upvote 0

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
Thanks.

The file is in a closed system, so I have to write back and forth between the system and internet. Its just a typo, it says in the workbook"A25"

On a side note: How do you end a line in your code with e.g. "Then" instead of "Then _"
 
Upvote 0

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
This is the line that the debugger doesnt like:
Code:
IF Workbooks("Pasientliste).Sheets("Behandlingsavdelingen").Cells("A7").Value = Workbooks("Teamarbeid").Sheets.("Ark3").Cells("A25").Value Then

Tripple checed the name of the workbooks. Also tried to change .Value to .Text ... still error.

If I just knew what the error means in this context...
 
Upvote 0

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
Actually yes, A7 is actually A7 and B7. However referencing the cell using Cell.(7, 1) bypassed the problem (!!). Thanks for putting me on the tought!

As a curiosity, how would you have solved the merged cell problem using a "A7" reference?
 
Upvote 0

Forum statistics

Threads
1,190,825
Messages
5,983,106
Members
439,824
Latest member
nellyc

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
Top