Sum of 2 cells in VBA
Sirhill
-
Polux31 Posted messages 7219 Status Membre -
Polux31 Posted messages 7219 Status Membre -
Hello,
I have a small issue because I want to add 2 cells from one sheet and put the result in a cell from another sheet. But the VBA formula I used does not work.
Could you help me solve this little problem, thank you in advance.
Here is my line of code:
Worksheets("DI").Range("Q" & MaxDI).Value = Application.WorksheetFunction.Sum(Sheets("Budget").Range("AV" & CptBudget), Sheets("Budget").Range("AT" & CptBudget))
Thank you for your help.
CR
I have a small issue because I want to add 2 cells from one sheet and put the result in a cell from another sheet. But the VBA formula I used does not work.
Could you help me solve this little problem, thank you in advance.
Here is my line of code:
Worksheets("DI").Range("Q" & MaxDI).Value = Application.WorksheetFunction.Sum(Sheets("Budget").Range("AV" & CptBudget), Sheets("Budget").Range("AT" & CptBudget))
Thank you for your help.
CR
I found the problem, it’s that the original cells are in text format (due to the conversion of a .csv file), so when I add them, it concatenates the two cells.
I’m now trying to find how to convert the format of the column from the .csv file to number format when I perform my extraction????
Here is the code I’m using..
'Allows converting the data copied from the CSV
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=True, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), TrailingMinusNumbers :=True
Thank you
CR