Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Please help with the syntax.

Posted on 2006-07-12
3
Medium Priority
?
152 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 66

Accepted Solution

by:
Jim Horn earned 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

972 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