Plz see the vba macro from the below link
https://drive.google.com/open?id=11FAIt ... 7uSJ5dzXgS
Correction of the Macro in which we can put formula
-
- Banned
- Posts: 253
- Joined: 22 Apr 2020, 17:24
-
- Administrator
- Posts: 78686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Correction of the Macro in which we can put formula
You have some quoted strings such as "BUY" in the formula. This formula itself is a quoted string. That causes confusion. To solve this, double the quotes for strings inside the formula. So for example, "BUY" becomes ""BUY""
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 78686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Correction of the Macro in which we can put formula
By the way, you can include code in your posts. Enclose it in [code] and [/code] tags. For example, your macro on Google Docs is:
Code: Select all
Sub test()
Dim Wb1 As Workbook, WS1 As Worksheet, Lr1 As Long
Set Wb1 = Workbooks.Open("C:\Users\Desktop\TEST.xlsx")
Set WS1 = Wb1.Worksheets.Item(1)
Let Lr1 = WS1.Range("H" & WS1.Rows.Count).End(xlUp).Row
WS1.Range("J2:J" & Lr1 & "").Value = "=IF(D2<H2,"BUY",IF(D2>H2,"SHORT","Delete"))"
WS1.Range("J2:J" & Lr1 & "").Value = WS1.Range("J2:J" & Lr1 & "").Value
Wb1.Save
Wb1.Close
End Sub
Best wishes,
Hans
Hans
-
- Banned
- Posts: 253
- Joined: 22 Apr 2020, 17:24
Re: Correction of the Macro in which we can put formula
Thnx Alot HansV Sir for helping me in solving this problem
Problem Solved
I tried to put the code in the post but i am getting error in pasting the code in this forum(/) this is been removed automatically
Problem Solved
I tried to put the code in the post but i am getting error in pasting the code in this forum(/) this is been removed automatically
-
- Administrator
- Posts: 7221
- Joined: 15 Jan 2010, 22:52
- Location: Middle of England
-
- Administrator
- Posts: 78686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Correction of the Macro in which we can put formula
If you copy code from the visual Basic Editor into a post, you shouldn't have problems.
Best wishes,
Hans
Hans
-
- Banned
- Posts: 253
- Joined: 22 Apr 2020, 17:24
Re: Correction of the Macro in which we can put formula
From excel, its not this website fault, I think my system fault