VBA error on form code

I had been running a form code that enters data into a spreadsheet.
It was working accurately, until I added three txtbox & three labels, now I get an error on line below, which enters a formula into column A on whatever sheet it is on.

Again, this was working properly, so the code is good, just adding the Discount, ED & Min Reduction were added now the formula below is an error.
I will attach the project if this will help.

       .Range("A" & lngNextRow).Formula = "=INDIRECT(""AK""&ROW())&IF(INDIRECT(""B""&ROW())<>"""","" ("","""")&INDIRECT(""B""&ROW())&IF(INDIRECT(""B""&ROW())<>"""",""-"","""")&INDIRECT(""C""&ROW())&IF(INDIRECT(""B""&ROW())<>"""","") "","""")&"" ""&INDIRECT(""E""&ROW())&"" ""&INDIRECT(""AM""&ROW())&"" ""&INDIRECT(""AL""&ROW())"""

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
There's nothing in that line that refers to anything on a form which is where I assume the new textboxes and labels are.

Have you tried entering the formula manually? If you can get it to work manually, converting it to VBA shouldn't be too hard.
Indirect does not handle active sheet or active cell

Before your call you can debug using the following
Debug.Print Application.ActiveSheet().ToString()
Debug.Print Application.ActiveCell().ToString()
//If not what you want
 Workbooks("BOOK1 XLS"). Worksheets("Sheet1 ").Activate

On that note create dynamic functions for each step of the way.
Euro5Author Commented:
I know, the line just enters the formula, the only relationship is that it works with the code where the other data is entered into the spreadsheet.
Yes, I have it working manually and I have it working on the old form just fine.
Three steps forward....two steps back.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Martin LissOlder than dirtCommented:
Can you show the manually entered formula?
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Though I have not downloaded your large file, see if the following line works without an issue..
Range("A" & lngNextRow).Formula = "=INDIRECT(""AK""&ROW())&IF(INDIRECT(""B""&ROW())<>"""","" ("","""")&INDIRECT(""B""&ROW())&IF(INDIRECT(""B""&ROW())<>"""",""-"","""")&INDIRECT(""C""&ROW())&IF(INDIRECT(""B""&ROW())<>"""","") "","""")&"" ""&INDIRECT(""E""&ROW())&"" ""&INDIRECT(""AM""&ROW())&"" ""&INDIRECT(""AL""&ROW())"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Euro5Author Commented:
Manually entered

=INDIRECT("AK"&ROW())&IF(INDIRECT("B"&ROW())<>""," (","")&INDIRECT("B"&ROW())&IF(INDIRECT("B"&ROW())<>"","-","")&INDIRECT("C"&ROW())&IF(INDIRECT("B"&ROW())<>"",") ","")&" "&INDIRECT("E"&ROW())

Open in new window

Euro5Author Commented:
That was it!!!!  I had the .Range  instead of the usual Range
Martin LissOlder than dirtCommented:
Replace your VBA formula with the manual one.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.