Type missmatch with .value

CsJHUN

Active Member
Joined
Jan 13, 2015
Messages
360
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
  2. Mobile
Hi guys!

Im trying to declare some value from cells value to other cell value.
(I give a list of datas in columns, the macro get the datas from do-until loop, write this data to a specific cell, call another macro, than step forward)

Here is what I have now:

Code:
Sub asd()
s = 1
Do
s = s + 1
vizsgaztato = Workbooks(MyName).Sheets("Temp00").Range("Q" & s).Value
vizsgazo = Workbooks(MyName).Sheets("Temp00").Range("R" & s).Value
tema = Workbooks(MyName).Sheets("Temp00").Range("S" & s).Value
szint = Workbooks(MyName).Sheets("Temp00").Range("T" & s).Value


Workbooks(MyName).Sheets("MAIN").Range("Thematic") = tema
Workbooks(MyName).Sheets("MAIN").Range("ThematicLevel") = szint
Workbooks(MyName).Sheets("MAIN").Range("Trainer") = vizsgaztato 
Workbooks(MyName).Sheets("MAIN").Range("Operator") = vizsgazo


Call Exam1Create.CreateExam
Loop Until s = Workbooks(MyName).Sheets("Temp00").Range("V1").Value
End Sub

On TEMP00, there will be 4 column. Vizsgazo ("Q") and vizsgaztato("R") stored as text, tema("S") and szint("T") are numbers. THe cell in "V1" is just a simple =counta(Q:Q)
I always got No.13 error messages at the first line (vizsgaztato)
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Do you have a 'Dim vizsgaztato as ....' statement somewhere within the code? The data type declared within the Dim statement probably doesn't match the data type that it will find in the target cells (Q2,Q3 etc.)
 
Upvote 0
You haven't declared or defined MyName so the variable is not being recognised as a valid workbook name.
 
Upvote 0
You haven't declared or defined MyName so the variable is not being recognised as a valid workbook name.

That would produce an out of range error wouldn't it? That must be valid to produce the type mismatch.
 
Upvote 0
That would produce an out of range error wouldn't it? That must be valid to produce the type mismatch.

That would be correct, Steve, I was pointing out what appeared to be an error, but didn't pay much attention to the error type :oops:
 
Upvote 0
Cool guys, thx for trying to help:)
Dim-ing not helped ofcourse, this is why not in the code.
Changed Workbooks(MyName).Sheets("MAIN") to ThisWorkbook.Sheets("MAIN") and its working now (and even less character :) ).
(and now just read the 2nd post, thx jasonb75)

Cheers again
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,649
Members
448,975
Latest member
sweeberry

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