|
* 답변하시는 분들께 도움이 되도록 자신의 환경을 아래 항목 옆에 기재해 주세요.
1. 엑셀 버전(95,97,2000,2002):
2. 윈도우즈의 버전(win95,win98,winME,winNT,win2000,winXP):
3. CPU (486,PentiumI/II/III/IV...):
4. RAM (32,64,128,256,512MB,1G...):
* 아래줄에 질문을 작성하세요 >>
안녕하세요?
반갑습니다.
버튼을 아래와 같이 만들었습니다.
Sub Make_Buttons()
Dim rngCell As Range
Dim btnButton As Button
Dim i As Integer
tLast = Worksheets("Index").UsedRange.Rows.Count
For Each rngCell In Worksheets("Index").Range("H2:H" & tLast)
Set btnButton = ActiveSheet.Buttons.Add _
(rngCell.Left, rngCell.Top, rngCell.Width, rngCell.Height)
btnButton.Caption = "T" & Mid(rngCell.Offset(0, -7), 2, 4) & ".xls"
btnButton.OnAction = "OpenFile_Training"
Next
End Sub
각 셀에 버튼이 모두 만들어 졌습니다. 그후 작업을 하면서 일부 셀의 버튼을 Delete 하게 되었습니다. 버튼이 있는 셀에는 버튼을 만들지 말고 버튼이 없는 셀에만 버튼을 만들려 합니다.
If rngCell Is btnButton Then 이 문장이 잘못된것 같습니다. 수정을 부탁드립니다.
Sub Make_Buttons_버튼없는셀()
Dim rngCell As Range
Dim btnButton As Button
Dim i As Integer
tLast = Worksheets("Index").UsedRange.Rows.Count
For Each rngCell In Worksheets("Index").Range("H2:H" & tLast)
If rngCell Is btnButton Then
Else
Set btnButton = ActiveSheet.Buttons.Add _
(rngCell.Left, rngCell.Top, rngCell.Width, rngCell.Height)
btnButton.Caption = "T" & Mid(rngCell.Offset(0, -7), 2, 4) & ".xls"
btnButton.OnAction = "OpenFile_Training"
End If
Next
End Sub
감사합니다.
즐거운 하루 되세요.
|
|