Notice
Recent Posts
Recent Comments
관리 메뉴

Creative Thinking Warehouse To be Rich

[엑셀VBA] 꾸미기 (Decoration) 본문

Engineering (+investing insight)/3. 컴퓨터 시스템

[엑셀VBA] 꾸미기 (Decoration)

LASER - 기술통역가 2024. 2. 29. 21:15

자동화 트레이딩을 위해서 엑셀 화면을 예쁘게 꾸밀 필요는 없지만 상승 중인 종목의 색상을 빨간색으로 표시하거나 

하락 중인 종목의 가격을 파란색으로 표시하는 정도는 자주 사용합니다. 

 

'Google에서 VBA, border 등의 키워드로 검색해 볼 것 
Sub TestColor() 
	Cells(1,1).Font.Color = RGB(255,0,0) 	'셀 글자색을 지정합니다. 
    Cells(1,1).Interior.Color = RGB(255,255,0) 	'셀 바탕색을 지정합니다. 
    Cells(1,1).Font.ColorIndex = xlAutomatic 	'셀 글자색을 기본으로 합니다. 
    Cells(1,1).Interior.ColorIndex = xlNone 	'셀 바탕색을 없앱니다. 
    
    'Range 영역을 설정합니다. 
    Dim r As Range 
    Set r = Range("B2:C4")
    
    '테두리를 그립니다. 
    r.BorderAround Weight:=xlThink
    
    '테투리를 삭제합니다. 
    r.Borders(xlEdgeLeft).LineStyle = xlNone
    r.Borders(xlEdgeTop).LineStyle = xlNone
    r.Borders(xlEdgeBottom).LineStyle = xlNone 
    r.Borders(xlEdgeRight).LineStyle = xlNone
End Sub