Issue with macro on big Excel sheetHow to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?Fixing my macro to copy a range to the next blank column?Excel 2016 VBA not writing to unlocked cellConditional copy Excel File-2 data to excel file-1?Show only selected table column after filter to new worksheetshow to read same data from two sheet then subtract the data using vbaExcel stops responding while executing loopTake the date in one worksheet and find the same date in another worksheet column and return the cell reference for that date to use in a loopexcel VBA code to ignore an email attachment if missing from folderVBA not working (copy data from one file and paste to different workbook below last row of data)

What fields between the rationals and the reals allow a good notion of 2D distance?

Is this part of the description of the Archfey warlock's Misty Escape feature redundant?

When were female captains banned from Starfleet?

Does Doodling or Improvising on the Piano Have Any Benefits?

Is this toilet slogan correct usage of the English language?

Has the laser at Magurele, Romania reached a tenth of the Sun's power?

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

Pre-mixing cryogenic fuels and using only one fuel tank

What kind of floor tile is this?

Why do ¬, ∀ and ∃ have the same precedence?

Quoting Keynes in a lecture

How do you make your own symbol when Detexify fails?

What is the difference between lands and mana?

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

A Trivial Diagnosis

Does the Linux kernel need a file system to run?

The Digit Triangles

Delete multiple columns using awk or sed

Creating two special characters

What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?

Stack Interview Code methods made from class Node and Smart Pointers

15% tax on $7.5k earnings. Is that right?

How could a planet have erratic days?

Multiplicative persistence



Issue with macro on big Excel sheet


How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?Fixing my macro to copy a range to the next blank column?Excel 2016 VBA not writing to unlocked cellConditional copy Excel File-2 data to excel file-1?Show only selected table column after filter to new worksheetshow to read same data from two sheet then subtract the data using vbaExcel stops responding while executing loopTake the date in one worksheet and find the same date in another worksheet column and return the cell reference for that date to use in a loopexcel VBA code to ignore an email attachment if missing from folderVBA not working (copy data from one file and paste to different workbook below last row of data)













0















This is my code:



Sub WO_Porownanie_Planu_do_Realizacji()
ActiveSheet.Range("H3").Select
Dim p2 As Double
Dim LR As Double
Dim Wynik As Integer
LR = Range("A" & Rows.count).End(xlUp).Row
p2 = LR
MsgBox (p2)
'p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2

Dim myfilein As String
myfilein = Application.GetOpenFilename

Dim wrks1 As Worksheet
Set wrks1 = ActiveSheet
Dim wrkbk As Workbook
Dim wrks As Worksheet

Set wrkbk = Workbooks.Open(myfilein)
Set wrks = wrkbk.Worksheets(1)

For wiersze = 3 To p2
For kolumny = 9 To 20
a1 = wrks1.Cells(wiersze, kolumny)
a2 = wrks.Cells(wiersze, kolumny)
Set Rng = wrks1.Cells(wiersze, kolumny)
Rng.ClearComments
Rng.AddComment

Wynik = a1 - a2
Rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
Next
Next
End Sub


This code compare 2 excel files and writes comments with difference between numbers on 2 sheets. I don't have any problems while testing on small sheets.



Example:
Small excel file



But while im trying on Big files I've got error:




Run-time error'13': Type mismatch.




And the whole makro stops in cell I67 and the comment only in this cell is empty.



Big excel file



I had to censor some cells.



Have you got any idea how to fix it?










share|improve this question









New contributor




Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 3





    What line does the error occur on?? Telling us the cell which is being processed at the time doesn't really help us. For debugging purposes, you should put Option Explicit at the top if the module and add enough variable declarations that it compiles.

    – John Coleman
    14 hours ago












  • Some of the numbers in those exceed the maximum value of an integer. Change to Dim Wynik AsLong or Dim Wynik As Double.

    – user11217663
    14 hours ago











  • Have you tried seeing what the result is Wynik = a1 - a2 at the point of error. Are you checking these are both values that can have a - operation?

    – Nathan_Sav
    14 hours ago






  • 1





    Variables wiersze, kolumny, a1,a2, Rng not declared.

    – Error 1004
    14 hours ago











  • @user11217663 I think that would give an overflow error rather than type mismatch?

    – Nathan_Sav
    14 hours ago















0















This is my code:



Sub WO_Porownanie_Planu_do_Realizacji()
ActiveSheet.Range("H3").Select
Dim p2 As Double
Dim LR As Double
Dim Wynik As Integer
LR = Range("A" & Rows.count).End(xlUp).Row
p2 = LR
MsgBox (p2)
'p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2

Dim myfilein As String
myfilein = Application.GetOpenFilename

Dim wrks1 As Worksheet
Set wrks1 = ActiveSheet
Dim wrkbk As Workbook
Dim wrks As Worksheet

Set wrkbk = Workbooks.Open(myfilein)
Set wrks = wrkbk.Worksheets(1)

For wiersze = 3 To p2
For kolumny = 9 To 20
a1 = wrks1.Cells(wiersze, kolumny)
a2 = wrks.Cells(wiersze, kolumny)
Set Rng = wrks1.Cells(wiersze, kolumny)
Rng.ClearComments
Rng.AddComment

Wynik = a1 - a2
Rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
Next
Next
End Sub


This code compare 2 excel files and writes comments with difference between numbers on 2 sheets. I don't have any problems while testing on small sheets.



Example:
Small excel file



But while im trying on Big files I've got error:




Run-time error'13': Type mismatch.




And the whole makro stops in cell I67 and the comment only in this cell is empty.



Big excel file



I had to censor some cells.



Have you got any idea how to fix it?










share|improve this question









New contributor




Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 3





    What line does the error occur on?? Telling us the cell which is being processed at the time doesn't really help us. For debugging purposes, you should put Option Explicit at the top if the module and add enough variable declarations that it compiles.

    – John Coleman
    14 hours ago












  • Some of the numbers in those exceed the maximum value of an integer. Change to Dim Wynik AsLong or Dim Wynik As Double.

    – user11217663
    14 hours ago











  • Have you tried seeing what the result is Wynik = a1 - a2 at the point of error. Are you checking these are both values that can have a - operation?

    – Nathan_Sav
    14 hours ago






  • 1





    Variables wiersze, kolumny, a1,a2, Rng not declared.

    – Error 1004
    14 hours ago











  • @user11217663 I think that would give an overflow error rather than type mismatch?

    – Nathan_Sav
    14 hours ago













0












0








0








This is my code:



Sub WO_Porownanie_Planu_do_Realizacji()
ActiveSheet.Range("H3").Select
Dim p2 As Double
Dim LR As Double
Dim Wynik As Integer
LR = Range("A" & Rows.count).End(xlUp).Row
p2 = LR
MsgBox (p2)
'p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2

Dim myfilein As String
myfilein = Application.GetOpenFilename

Dim wrks1 As Worksheet
Set wrks1 = ActiveSheet
Dim wrkbk As Workbook
Dim wrks As Worksheet

Set wrkbk = Workbooks.Open(myfilein)
Set wrks = wrkbk.Worksheets(1)

For wiersze = 3 To p2
For kolumny = 9 To 20
a1 = wrks1.Cells(wiersze, kolumny)
a2 = wrks.Cells(wiersze, kolumny)
Set Rng = wrks1.Cells(wiersze, kolumny)
Rng.ClearComments
Rng.AddComment

Wynik = a1 - a2
Rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
Next
Next
End Sub


This code compare 2 excel files and writes comments with difference between numbers on 2 sheets. I don't have any problems while testing on small sheets.



Example:
Small excel file



But while im trying on Big files I've got error:




Run-time error'13': Type mismatch.




And the whole makro stops in cell I67 and the comment only in this cell is empty.



Big excel file



I had to censor some cells.



Have you got any idea how to fix it?










share|improve this question









New contributor




Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












This is my code:



Sub WO_Porownanie_Planu_do_Realizacji()
ActiveSheet.Range("H3").Select
Dim p2 As Double
Dim LR As Double
Dim Wynik As Integer
LR = Range("A" & Rows.count).End(xlUp).Row
p2 = LR
MsgBox (p2)
'p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2

Dim myfilein As String
myfilein = Application.GetOpenFilename

Dim wrks1 As Worksheet
Set wrks1 = ActiveSheet
Dim wrkbk As Workbook
Dim wrks As Worksheet

Set wrkbk = Workbooks.Open(myfilein)
Set wrks = wrkbk.Worksheets(1)

For wiersze = 3 To p2
For kolumny = 9 To 20
a1 = wrks1.Cells(wiersze, kolumny)
a2 = wrks.Cells(wiersze, kolumny)
Set Rng = wrks1.Cells(wiersze, kolumny)
Rng.ClearComments
Rng.AddComment

Wynik = a1 - a2
Rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
Next
Next
End Sub


This code compare 2 excel files and writes comments with difference between numbers on 2 sheets. I don't have any problems while testing on small sheets.



Example:
Small excel file



But while im trying on Big files I've got error:




Run-time error'13': Type mismatch.




And the whole makro stops in cell I67 and the comment only in this cell is empty.



Big excel file



I had to censor some cells.



Have you got any idea how to fix it?







excel vba






share|improve this question









New contributor




Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 14 hours ago









Pᴇʜ

24.3k63052




24.3k63052






New contributor




Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 14 hours ago









FroncuFroncu

82




82




New contributor




Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Froncu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 3





    What line does the error occur on?? Telling us the cell which is being processed at the time doesn't really help us. For debugging purposes, you should put Option Explicit at the top if the module and add enough variable declarations that it compiles.

    – John Coleman
    14 hours ago












  • Some of the numbers in those exceed the maximum value of an integer. Change to Dim Wynik AsLong or Dim Wynik As Double.

    – user11217663
    14 hours ago











  • Have you tried seeing what the result is Wynik = a1 - a2 at the point of error. Are you checking these are both values that can have a - operation?

    – Nathan_Sav
    14 hours ago






  • 1





    Variables wiersze, kolumny, a1,a2, Rng not declared.

    – Error 1004
    14 hours ago











  • @user11217663 I think that would give an overflow error rather than type mismatch?

    – Nathan_Sav
    14 hours ago












  • 3





    What line does the error occur on?? Telling us the cell which is being processed at the time doesn't really help us. For debugging purposes, you should put Option Explicit at the top if the module and add enough variable declarations that it compiles.

    – John Coleman
    14 hours ago












  • Some of the numbers in those exceed the maximum value of an integer. Change to Dim Wynik AsLong or Dim Wynik As Double.

    – user11217663
    14 hours ago











  • Have you tried seeing what the result is Wynik = a1 - a2 at the point of error. Are you checking these are both values that can have a - operation?

    – Nathan_Sav
    14 hours ago






  • 1





    Variables wiersze, kolumny, a1,a2, Rng not declared.

    – Error 1004
    14 hours ago











  • @user11217663 I think that would give an overflow error rather than type mismatch?

    – Nathan_Sav
    14 hours ago







3




3





What line does the error occur on?? Telling us the cell which is being processed at the time doesn't really help us. For debugging purposes, you should put Option Explicit at the top if the module and add enough variable declarations that it compiles.

– John Coleman
14 hours ago






What line does the error occur on?? Telling us the cell which is being processed at the time doesn't really help us. For debugging purposes, you should put Option Explicit at the top if the module and add enough variable declarations that it compiles.

– John Coleman
14 hours ago














Some of the numbers in those exceed the maximum value of an integer. Change to Dim Wynik AsLong or Dim Wynik As Double.

– user11217663
14 hours ago





Some of the numbers in those exceed the maximum value of an integer. Change to Dim Wynik AsLong or Dim Wynik As Double.

– user11217663
14 hours ago













Have you tried seeing what the result is Wynik = a1 - a2 at the point of error. Are you checking these are both values that can have a - operation?

– Nathan_Sav
14 hours ago





Have you tried seeing what the result is Wynik = a1 - a2 at the point of error. Are you checking these are both values that can have a - operation?

– Nathan_Sav
14 hours ago




1




1





Variables wiersze, kolumny, a1,a2, Rng not declared.

– Error 1004
14 hours ago





Variables wiersze, kolumny, a1,a2, Rng not declared.

– Error 1004
14 hours ago













@user11217663 I think that would give an overflow error rather than type mismatch?

– Nathan_Sav
14 hours ago





@user11217663 I think that would give an overflow error rather than type mismatch?

– Nathan_Sav
14 hours ago












2 Answers
2






active

oldest

votes


















0














I try to modify the code . Try the new version and if you need help let me know:



Option Explicit

Sub WO_Porownanie_Planu_do_Realizacji()

' ActiveSheet.Range("H3").Select
' p2 = LR
' p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2
' Dim p2 As Double

Dim LR As Long, wiersze As Long, kolumny As Long
Dim Wynik As Double, a1 As Double, a2 As Double
Dim wrks As Worksheet
Dim wrkbk As Workbook
Dim myfilein As String
Dim rng As Range

With ThisWorkbook.Worksheets("Sheet1")

LR = Range("A" & Rows.Count).End(xlUp).Row

MsgBox (LR)

myfilein = Application.GetOpenFilename

Set wrkbk = Workbooks.Open(myfilein)
Set wrks = wrkbk.Worksheets(1)

For wiersze = 3 To LR

For kolumny = 9 To 20

a1 = .Cells(wiersze, kolumny)
a2 = wrks.Cells(wiersze, kolumny)
Set rng = .Cells(wiersze, kolumny)
rng.ClearComments
rng.AddComment

Wynik = a1 - a2
rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
Next

Next

End With

End Sub





share|improve this answer























  • Type mismatch a2 = wrks.Cells(wiersze, kolumny)

    – Froncu
    13 hours ago











  • Debug the code and provide wrks.Cells(wiersze, kolumny) value please

    – Error 1004
    13 hours ago


















0














A possible cause of your type mismatch on the line with a1 - a2:



Your IFERROR statement (JEZELI.BLAD) is putting a "" into the cell (if the formula in I67 is the same as the one you show for J67)



When you execute the subtraction, you cannot have a "" as one of the factors, hence the error.



One work-around would be to test the values of a1 and a2 before doing the subtraction.



eg:



If VarType(a1) = vbString Then a1 = 0
If VarType(a2) = vbString Then a2 = 0


or maybe something like:



Dim a1 As Double, a2 As Double 
a1 = Val(wrks1.Cells(wiersze, kolumny))
a2 = Val(wrks.Cells(wiersze, kolumny))


which will convert a non-numeric string to zero (0)






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Froncu is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280114%2fissue-with-macro-on-big-excel-sheet%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I try to modify the code . Try the new version and if you need help let me know:



    Option Explicit

    Sub WO_Porownanie_Planu_do_Realizacji()

    ' ActiveSheet.Range("H3").Select
    ' p2 = LR
    ' p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2
    ' Dim p2 As Double

    Dim LR As Long, wiersze As Long, kolumny As Long
    Dim Wynik As Double, a1 As Double, a2 As Double
    Dim wrks As Worksheet
    Dim wrkbk As Workbook
    Dim myfilein As String
    Dim rng As Range

    With ThisWorkbook.Worksheets("Sheet1")

    LR = Range("A" & Rows.Count).End(xlUp).Row

    MsgBox (LR)

    myfilein = Application.GetOpenFilename

    Set wrkbk = Workbooks.Open(myfilein)
    Set wrks = wrkbk.Worksheets(1)

    For wiersze = 3 To LR

    For kolumny = 9 To 20

    a1 = .Cells(wiersze, kolumny)
    a2 = wrks.Cells(wiersze, kolumny)
    Set rng = .Cells(wiersze, kolumny)
    rng.ClearComments
    rng.AddComment

    Wynik = a1 - a2
    rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
    Next

    Next

    End With

    End Sub





    share|improve this answer























    • Type mismatch a2 = wrks.Cells(wiersze, kolumny)

      – Froncu
      13 hours ago











    • Debug the code and provide wrks.Cells(wiersze, kolumny) value please

      – Error 1004
      13 hours ago















    0














    I try to modify the code . Try the new version and if you need help let me know:



    Option Explicit

    Sub WO_Porownanie_Planu_do_Realizacji()

    ' ActiveSheet.Range("H3").Select
    ' p2 = LR
    ' p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2
    ' Dim p2 As Double

    Dim LR As Long, wiersze As Long, kolumny As Long
    Dim Wynik As Double, a1 As Double, a2 As Double
    Dim wrks As Worksheet
    Dim wrkbk As Workbook
    Dim myfilein As String
    Dim rng As Range

    With ThisWorkbook.Worksheets("Sheet1")

    LR = Range("A" & Rows.Count).End(xlUp).Row

    MsgBox (LR)

    myfilein = Application.GetOpenFilename

    Set wrkbk = Workbooks.Open(myfilein)
    Set wrks = wrkbk.Worksheets(1)

    For wiersze = 3 To LR

    For kolumny = 9 To 20

    a1 = .Cells(wiersze, kolumny)
    a2 = wrks.Cells(wiersze, kolumny)
    Set rng = .Cells(wiersze, kolumny)
    rng.ClearComments
    rng.AddComment

    Wynik = a1 - a2
    rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
    Next

    Next

    End With

    End Sub





    share|improve this answer























    • Type mismatch a2 = wrks.Cells(wiersze, kolumny)

      – Froncu
      13 hours ago











    • Debug the code and provide wrks.Cells(wiersze, kolumny) value please

      – Error 1004
      13 hours ago













    0












    0








    0







    I try to modify the code . Try the new version and if you need help let me know:



    Option Explicit

    Sub WO_Porownanie_Planu_do_Realizacji()

    ' ActiveSheet.Range("H3").Select
    ' p2 = LR
    ' p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2
    ' Dim p2 As Double

    Dim LR As Long, wiersze As Long, kolumny As Long
    Dim Wynik As Double, a1 As Double, a2 As Double
    Dim wrks As Worksheet
    Dim wrkbk As Workbook
    Dim myfilein As String
    Dim rng As Range

    With ThisWorkbook.Worksheets("Sheet1")

    LR = Range("A" & Rows.Count).End(xlUp).Row

    MsgBox (LR)

    myfilein = Application.GetOpenFilename

    Set wrkbk = Workbooks.Open(myfilein)
    Set wrks = wrkbk.Worksheets(1)

    For wiersze = 3 To LR

    For kolumny = 9 To 20

    a1 = .Cells(wiersze, kolumny)
    a2 = wrks.Cells(wiersze, kolumny)
    Set rng = .Cells(wiersze, kolumny)
    rng.ClearComments
    rng.AddComment

    Wynik = a1 - a2
    rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
    Next

    Next

    End With

    End Sub





    share|improve this answer













    I try to modify the code . Try the new version and if you need help let me know:



    Option Explicit

    Sub WO_Porownanie_Planu_do_Realizacji()

    ' ActiveSheet.Range("H3").Select
    ' p2 = LR
    ' p2 = Range(Selection, ActiveCell.End(xlDown)).count + 2
    ' Dim p2 As Double

    Dim LR As Long, wiersze As Long, kolumny As Long
    Dim Wynik As Double, a1 As Double, a2 As Double
    Dim wrks As Worksheet
    Dim wrkbk As Workbook
    Dim myfilein As String
    Dim rng As Range

    With ThisWorkbook.Worksheets("Sheet1")

    LR = Range("A" & Rows.Count).End(xlUp).Row

    MsgBox (LR)

    myfilein = Application.GetOpenFilename

    Set wrkbk = Workbooks.Open(myfilein)
    Set wrks = wrkbk.Worksheets(1)

    For wiersze = 3 To LR

    For kolumny = 9 To 20

    a1 = .Cells(wiersze, kolumny)
    a2 = wrks.Cells(wiersze, kolumny)
    Set rng = .Cells(wiersze, kolumny)
    rng.ClearComments
    rng.AddComment

    Wynik = a1 - a2
    rng.Comment.Text Text:="Zaoszczedzono: " & Wynik
    Next

    Next

    End With

    End Sub






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 13 hours ago









    Error 1004Error 1004

    2,5531517




    2,5531517












    • Type mismatch a2 = wrks.Cells(wiersze, kolumny)

      – Froncu
      13 hours ago











    • Debug the code and provide wrks.Cells(wiersze, kolumny) value please

      – Error 1004
      13 hours ago

















    • Type mismatch a2 = wrks.Cells(wiersze, kolumny)

      – Froncu
      13 hours ago











    • Debug the code and provide wrks.Cells(wiersze, kolumny) value please

      – Error 1004
      13 hours ago
















    Type mismatch a2 = wrks.Cells(wiersze, kolumny)

    – Froncu
    13 hours ago





    Type mismatch a2 = wrks.Cells(wiersze, kolumny)

    – Froncu
    13 hours ago













    Debug the code and provide wrks.Cells(wiersze, kolumny) value please

    – Error 1004
    13 hours ago





    Debug the code and provide wrks.Cells(wiersze, kolumny) value please

    – Error 1004
    13 hours ago













    0














    A possible cause of your type mismatch on the line with a1 - a2:



    Your IFERROR statement (JEZELI.BLAD) is putting a "" into the cell (if the formula in I67 is the same as the one you show for J67)



    When you execute the subtraction, you cannot have a "" as one of the factors, hence the error.



    One work-around would be to test the values of a1 and a2 before doing the subtraction.



    eg:



    If VarType(a1) = vbString Then a1 = 0
    If VarType(a2) = vbString Then a2 = 0


    or maybe something like:



    Dim a1 As Double, a2 As Double 
    a1 = Val(wrks1.Cells(wiersze, kolumny))
    a2 = Val(wrks.Cells(wiersze, kolumny))


    which will convert a non-numeric string to zero (0)






    share|improve this answer





























      0














      A possible cause of your type mismatch on the line with a1 - a2:



      Your IFERROR statement (JEZELI.BLAD) is putting a "" into the cell (if the formula in I67 is the same as the one you show for J67)



      When you execute the subtraction, you cannot have a "" as one of the factors, hence the error.



      One work-around would be to test the values of a1 and a2 before doing the subtraction.



      eg:



      If VarType(a1) = vbString Then a1 = 0
      If VarType(a2) = vbString Then a2 = 0


      or maybe something like:



      Dim a1 As Double, a2 As Double 
      a1 = Val(wrks1.Cells(wiersze, kolumny))
      a2 = Val(wrks.Cells(wiersze, kolumny))


      which will convert a non-numeric string to zero (0)






      share|improve this answer



























        0












        0








        0







        A possible cause of your type mismatch on the line with a1 - a2:



        Your IFERROR statement (JEZELI.BLAD) is putting a "" into the cell (if the formula in I67 is the same as the one you show for J67)



        When you execute the subtraction, you cannot have a "" as one of the factors, hence the error.



        One work-around would be to test the values of a1 and a2 before doing the subtraction.



        eg:



        If VarType(a1) = vbString Then a1 = 0
        If VarType(a2) = vbString Then a2 = 0


        or maybe something like:



        Dim a1 As Double, a2 As Double 
        a1 = Val(wrks1.Cells(wiersze, kolumny))
        a2 = Val(wrks.Cells(wiersze, kolumny))


        which will convert a non-numeric string to zero (0)






        share|improve this answer















        A possible cause of your type mismatch on the line with a1 - a2:



        Your IFERROR statement (JEZELI.BLAD) is putting a "" into the cell (if the formula in I67 is the same as the one you show for J67)



        When you execute the subtraction, you cannot have a "" as one of the factors, hence the error.



        One work-around would be to test the values of a1 and a2 before doing the subtraction.



        eg:



        If VarType(a1) = vbString Then a1 = 0
        If VarType(a2) = vbString Then a2 = 0


        or maybe something like:



        Dim a1 As Double, a2 As Double 
        a1 = Val(wrks1.Cells(wiersze, kolumny))
        a2 = Val(wrks.Cells(wiersze, kolumny))


        which will convert a non-numeric string to zero (0)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 7 hours ago

























        answered 13 hours ago









        Ron RosenfeldRon Rosenfeld

        23.9k41640




        23.9k41640




















            Froncu is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            Froncu is a new contributor. Be nice, and check out our Code of Conduct.












            Froncu is a new contributor. Be nice, and check out our Code of Conduct.











            Froncu is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280114%2fissue-with-macro-on-big-excel-sheet%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현