
Parth Thaker
New Member
Members

Forum Posts: 2
Member Since:
July 30, 2020
July 30, 2020

Hi,
I am trying to add VBA for inserting formula in a range, but compile error is coming. Can someone please help on this.
i have imported the macro in personal.xlsb file hence i am using macro free work book.

Philip Treacy
Admin

Forum Posts: 1548
Member Since:
October 5, 2010
October 5, 2010

Hi,
You need to double up on the double quotes inside the string, otherwise it looks to VBA like you are ending the string because there's a single " in the middle of the string.
Range("S2:S" & lastRow).Formula = " =IF(OR(L2=30003322, L2=30004056, L2=30009486, L2=30013917, B2=""CHP Hydra""), ""CHP-MMD"", IF(OR(L2=30004254, L2=30007286, Q2=""ABS""), ""ABS"", ""CHP-Oprn""))"
Regards
Phil

Answers Post
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Mynda Treacy, QSolutions Group
Guest(s) 9
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
jaryszek: 183
Newest Members:
Herbie Key
Trevor Pindling
Stevan Kanjo
Erin Sheldon
Nikita Bhatia
Sheilah Taylor
Clare Webber
David Jenssen
Dominic Brosnahan
Young You
Forum Stats:
Groups: 3
Forums: 24
Topics: 6526
Posts: 28575
Member Stats:
Guest Posters: 49
Members: 32809
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —
