2014-04-07 3 views
0

일부 숙제를하고 있는데 왜 코드가 작동하지 않는지 알 수 없습니다. 지정은 이름을 요청한 다음 B10에서 빨간색 텍스트로 응답하는 것입니다.VBA 오류 컴파일 : 예상 : 식

enter image description here

어떤 도움 증조 감사 같습니다

여기 내 코드입니다!

+1

아닌 그림을 사용하는 훨씬 쉽게 될 것입니다 – Brad

+0

또한 어떤 줄이 오류의 원인입니까? – Brad

답변

0

고려 :

이 오류는 라인 With RAnge("b10").Font.ColocarIndex = 3에서 오는
Sub qwerty() 
    Sheets("MyNewSheet").Activate 
    With Range("B10") 
     .Font.ColorIndex = 3 
     strName = Application.InputBox(Prompt:="Please enter your name.", Type:=2) 
     .Value = strName 
    End With 
End Sub 
1

With supose 만 텍스트로 여기에 코드를 붙여 객체 (안 식)

sName = Application.InputBox(Prompt:="Please enter your name.", Type:=2)  
With Sheets("MyNewSheet").Range("B10") 
    .Font.ColorIndex = 3 
    .Value = sName 
End With