|
▼へっぽこ さん:
ありがとうございます。
下記要領でテストしてみたのですが
"文字見易くする"→"作動中"への
変化ないのですが?
どこか違いますか
Private Sub CommandButton1_Click()
Dim 文字見易くする As String
Dim i As Long, k As Long
Dim mySource As Worksheet
Dim myRange As Range, c As Range
Dim s1 As String
Dim s2 As String
Dim j As Long
Dim v As Variant
文字見易くする = CommandButton1.Caption
CommandButton1.Caption = "作動中"
ActiveSheet.Unprotect
Application.ScreenUpdating = False
v = Array("C3", "G3", "N3", "S3", "V3")
j = 8
For i = LBound(v) To UBound(v)
Worksheets("支払入力").Range(v(i)).Resize(20).Formula _
= "=LEFTB(発注先!$B" & j & ",6)" & _
" & "" "" & 発注先!$J" & j & ""
j = j + 20
Next
Range("C28,C3:D22,G3:J22,N3:O22,S3:S22,V3:W22").Select
Selection.Font.ColorIndex = 10
Range("C3").Select
Set mySource = Worksheets("発注先")
Set myRange = Range("C3:C22,G3:G22,N3:N22,S3:S22,V3:V22")
k = 0
For Each c In myRange
With c
k = k + 1
s1 = mySource.Cells(7 + k, 2).Value
s2 = mySource.Cells(7 + k, 10).Value
.Value = StrConv(LeftB(StrConv(s1, vbFromUnicode), 6), vbUnicode) & " " & s2
i = InStr(.Text, " ")
If i Then
.Characters(i).Font.Color = vbBlue
End If
End With
Next
Application.ScreenUpdating = True
Call 保護8
CommandButton1.Caption = "文字見易くする"
End Sub
>こういうこと?
>
>Private Sub CommandButton1_Click()
> Dim 元の文字 As String
>
> 元の文字 = CommandButton1.Caption
> CommandButton1.Caption = "実行中"
>
> MsgBox "もどしますね。"
>
> CommandButton1.Caption = 元の文字
>End Sub
>
>※わざわざ「元の文字」なんていう変数に入れとく必要はないですね。
|
|