PDA

View Full Version : VBA help



lexluther88
10-26-2006, 05:03 PM
Some mod can delete my post, The reply helped, and I got the job done. Thanks!

Bartek
10-27-2006, 12:50 AM
Hi,


If ActiveCell.Row < 3 Or ActiveCell.Row > 6 Or _
ActiveCell.Column < 5 Or ActiveCell.Column > 8 Then
...your code here...
End If


You may do it an easirer way, by restricting the Scroll Area of the Worksheet. For example, if your board for memory game is in range "b2:f5" use:
ActiveSheet.ScrollArea = "b2:f5"


Disable the button that selects the first cell and enable the button that selects the second cell, ensuring that the player's next action is to uncover the second cell of the turn.

if I understand you correctly, you want the user to select a cell and then press the button. You can enable / disable buttons with VBA:

ActiveSheet.CommandButton1.Enabled = False
ActiveSheet.CommandButton2.Enabled = True


But much better and simpler way is to use Worsheet_SelectionChange event for revealing the cell in such game.

If you want to make your memery game in Excel, you may also study other such games with viewable code. Just follow this link (http://www.dzikosoft.com/gmexcel/library2.html#libcat9) :)