Macro on Button needs syntax help

J

Jeff

Hi, I want to create a macro that runs from a button but I need some help
with the coding. I think I know how to attach it to a button after it's
coded. Here is some code describing what I want to do but much of syntax
needs work. Any help would be greatly appreciated. Thanks

SUB Macro for Button Hint

For All JIndex From B To J
For All IIndex FROM 7 To 15

If Cell(IIndex,JIndex) = SpecialCells(xlCellTypeBlanks) Then

If Cell(JIndex:IIndex) in Range(B7:D9) then CbeRange=B7:D9 else
If Cell(JIndex:IIndex) in Range(E7:G9) then CbeRange=E7:G9 else
If Cell(JIndex:IIndex) in Range(H7:J9) then CbeRange=H7:J9 else
If Cell(JIndex:IIndex) in Range(B10:D12) then CbeRange=B10:D12 else
If Cell(JIndex:IIndex) in Range(E10:G12) then CbeRange=E10:G12 else
If Cell(JIndex:IIndex) in Range(H10:J12) then CbeRange=H10:J12 else
If Cell(JIndex:IIndex) in Range(B13:D15) then CbeRange=B13:D15 else
If Cell(JIndex:IIndex) in Range(E13:G15) then CbeRange=E13:G15 else
If Cell(JIndex:IIndex) in Range(H13:J15) then CbeRange=H13:J15

Ctr=0
For All Tests From 1 To 9
If AND(CountIf($JIndex$7:$JIndex$15,Tests)=0 ,
CountIf($B$IIndex:$J$IIndex,Tests)=0 , CountIf(CbeRange,Tests)=0) Then
Ctr=Ctr+1
Fill=Tests
JIxx = JIndex
IIxx = IIndex
End If
Next Tests

If Ctr=1 Then
Cell(JIxx:IIxx) = Fill
For Cell(JIxx:IIxx) set text color = BLUE
STOP - Exit this sub
End If

End If

Next IIndex
Next JIndex

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top