Jump to content
The mkiv Supra Owners Club

Simple Excel and VB code help please....


AlexJames

Recommended Posts

Hey guys... for all you excel gurus out there...

 

I need some simple code but i seem to remember some of the code is written slightly different when using vb in excel instead of vb stand alone.

 

I need something simple like ...

 

If c2.value = "***" then msgbox ("correct")

 

or

 

If c2.value = "***" then D11.value = "something else"

 

I know that in excel If statments will work when I code them against a command button but the .value field is obviously not correct... am I making sense? :blink:

Link to comment
Share on other sites

That's right, but the syntax is like this:

 

If Sheets("Sheet1").Range("C2").Value = "yes" Then ....

 

Basically, the code drills down through the layers of an Excel spreadsheet: first it specifies the sheet, then the cell in that sheet. If you want to go wild, you can specify the spreadsheet itself if you've got more than one open (only do this if you need to: it's pointless otherwise).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. You might also be interested in our Guidelines, Privacy Policy and Terms of Use.