Centrifugal Compressor data sheet.xlsm
안녕하세요.
업무중에 엑셀에 수많은 도형 (동그라미 / 네모) 가 삽입이 되어 있습니다.
예시는 아래와 같습니다 .
O 이름
O 주소
ㅁ 나이
위에 동그라미나, 네모를 마우스로 클릭 했을경우 파란으로 변경 되도록 할수 있는 방안에 대해서 문의 드립니다.
기존 파일에 macro 로 파일이 있었던것 같으나 오류등으로 인해 작동이 불가한 상태입니다.
설명이 부족한건지 모르겠으나 고수님의 의견 부탁드립니다.
추가 질의
인터넷에 코드를 아래와 같이 찾았습니다.
근데 문제는 Sheet가 10개 가량 되는데 Sheet가 5 만 적용되고, 나머지는 적용이 안됩니다.
도움 부탁드립니다.
------------------------------------------------------------------------------------------------
Public DoneSheet() As Boolean 'Keeps track of whether or not a
'a sheet's checkmarks have already
'been programmed. Once each datasheet
'has been used once, you won't have
'the delay of going through the
'program if you switch back to a
'datasheet. This array will be sized
'to accommodate the total number of
'sheets in the workbook.
Sub MatchShapesToSub() 'Make all checkmarks ready for program.
Dim sh As shape
For Each sh In ActiveSheet.Shapes
' Some circles and squares have been grouped together to form
' an entity. We have to break them up.
If Left(sh.Name, 5) = "Group" Then
sh.Ungroup
End If
Next
For Each sh In ActiveSheet.Shapes
' Assign the coloring subroutine to each circle on the datasheet.
If Left(sh.Name, 4) = "Oval" Then
sh.OnAction = "ChangeColor"
ElseIf Left(sh.Name, 9) = "Rectangle" Then
' Push all rectangles to the back. This way, it's more likely
' that only the circle will be colored when the mouse goes over
' it.
sh.ZOrder msoSendToBack
sh.OnAction = "ChangeColor"
End If
Next
End Sub
Sub ChangeColor() 'Program to turn on & off the fill color in the
'checkmarks. The color chosen is blue.
Dim WhichSheet As String
' Finds out the sheet from which the button was clicked.
WhichSheet = Application.Caller
With ActiveSheet.Shapes(WhichSheet)
If .Fill.ForeColor.RGB = RGB(0, 0, 256) Then
If .Fill.Visible = msoFalse Then
.Fill.Visible = msoTrue
.Fill.Solid
Else
.Fill.Visible = msoFalse
End If
Else
.Fill.ForeColor.RGB = RGB(0, 0, 256)
.Fill.Solid
If .Fill.Visible = msoFalse Then
.Fill.Visible = msoTrue
End If
End If
End With
End Sub
첫댓글 ㅁ, ㅇ, 삼각형 도형들에 지정된 매크로가 풀린거 같은데요.
해당버튼에 매크로 지정해 주시면 됨니다
도형에 마우스 올리고 마우스오른버튼크릭한 후 매크로 지정(N) 선택한 후
changeCollor 더블크릭해 주시면 해당버튼 적용됨니다.
1. 해당시트에서 도형 하나를 선택함.
2. Ctrl-Shift-Space 키를 누름.
3. 마우스 오른쪽 키를 눌러 매크로 지정 선택
4. 매크로 목록에서 ChangeColor 선택하여 지정