Copying row from a range to another file/Run time error 13-Type mismatch

Shanghai3

New Member
Joined
Dec 5, 2021
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Dear Users,

I have problem with the following row in my macro:
Does anyone know what can be the problem?
Thank you for your help in advance.

Regards,

Shanghai3

VBA Code:
omszrange.Rows(rownum).Copy Workbooks(Filename2.Cells(i, 1)).Worksheets(Tabname3.Cells(i, 1)).finishrange
 
Dear Joe4,

I really thank you, that you are trying to help me.

I have tried what you proposed and I checked the cursor above the variables and Filename2 variable has the right value, Tabname3 also has the right value, but
there some problem occurs by pasting to Range C63. I still do not know what is the problem.

VBA Code:
Workbooks(Filename2.Cells(i, 1)).Worksheets(Tabname3.Cells(i, 1)).Range("C63").PasteSpecial Paste:=xlPasteValues

The error message is: Run time error 13-Type mismatch.

Possibly I am dummy, but I really do not know what is the problem.

Regards,

Shanghai3
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
@Shanghai3 what happens if you replace:
VBA Code:
omszrange.Rows(rownum).Copy
            Workbooks(Filename2.Cells(i, 1)).Worksheets(Tabname3.Cells(i, 1)).Range("C63").PasteSpecial Paste:=xlPasteValues

with:
VBA Code:
omszrange.Copy
            Workbooks(Filename2.Cells(i, 1)).Worksheets(Tabname3.Cells(i, 1)).Range("C63").PasteSpecial Paste:=xlPasteValues
 
Upvote 0
Dear Joe4,

I really thank you, that you are trying to help me.

I have tried what you proposed and I checked the cursor above the variables and Filename2 variable has the right value, Tabname3 also has the right value, but
there some problem occurs by pasting to Range C63. I still do not know what is the problem.

VBA Code:
Workbooks(Filename2.Cells(i, 1)).Worksheets(Tabname3.Cells(i, 1)).Range("C63").PasteSpecial Paste:=xlPasteValues

The error message is: Run time error 13-Type mismatch.

Possibly I am dummy, but I really do not know what is the problem.

Regards,

Shanghai3
You did not do what I suggested at all. Get rid of ALL your variables, and replace them with hard-coded values.
The first step is to get it working using ALL hard-codes values. This will ensure that you have the structure correct.
Once you have that working, then you can start replacing the hard-coded values with variables, one at a time.

I am trying to teach you a method on how to figure out these sort of things for yourself.
Start with a simple example (hard-coded) of what you want to do, and work up from there.
 
Upvote 0

Forum statistics

Threads
1,215,539
Messages
6,125,403
Members
449,222
Latest member
taner zz

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