Solved

Please help with the syntax.

Posted on 2006-07-12
3
144 Views
Last Modified: 2010-04-30
Excel VBA

I need to join these two statments together.  

Sheet22.Range("SRP") = Sheet38.Range("e6") / 100 and
Sheet22.Range("AA28:AA57") = Sheet38.Range("e6") / 100

Please help with the syntax.

Here is the whole piece of code.

///////////////////////////////////////////////////////

If Range("W28") = "Govt" Then
Sheet22.Range("SRP") = Sheet38.Range("e6") / 100
Sheet22.Range("AA28:AA57") = Sheet38.Range("e6") / 100
Else
Sheet22.Range("SRP") = Sheet38.Range("d6") / 100
Sheet22.Range("AA28:AA57") = Sheet38.Range("d6") / 100
End If
0
Comment
Question by:ca1358
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 17093460
Define ' join these two statments together.  '.  Test them together as a condition?

The VB code you have below the //// line appears fine.
0
 

Author Comment

by:ca1358
ID: 17093721
I am using this piece of code in two sections.

One after the Userform.Combo1 (AfterUpdate) and works fine but
I using it after a Combo1 (Change event) on the spreadsheet and I am getting error

Runtime 1004
Application-define or object deine error.

Any suggestions?

Thank you for you help!

0
 

Author Comment

by:ca1358
ID: 17095209
I have the answer.  I split the procedure and move one of them to another event.

Thanks for the help!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now