Excel VBA

2008. 10. 29. 16:25
프로젝트를 하다보면 EXCEL VBA를 이용하여 대량의 데이터를 가공해야할 경우가 많은데 자주 까먹고 그래서 여기에 필요한 부분이 있으면 그때 그때 기록해서 활용해야겠당.

혹시 필요한 부분이 있다면 유용하게 쓰시길 바랍니다.


○ 지정된 Column의 Cell에 데이터가 있을경우 지정된 위치로 이동

Dim i
Dim str

For i = 1 To 400 Step 1
    str = Cells(i, 1).Text

    If (Len(str) > 0) Then
        Cells(i, 5).Value = str
        Cells(i, 1).Clear
    End If
Next i





○ MS-WORD의 지정된 셀의 이름 지정과 셀의 넓이 조절

On Error GoTo ErrorHandler
   
Selection.Tables(1).Cell(1, 4).Range.Text = "1차점검"
Selection.Tables(1).Cell(1, 5).Range.Text = "2차점검"
   
For i = 1 To 30 Step 1
    Selection.Tables(1).Cell(i, 1).Width = CentimetersToPoints(0.8)
    Selection.Tables(1).Cell(i, 2).Width = CentimetersToPoints(1.2)
    Selection.Tables(1).Cell(i, 3).Width = CentimetersToPoints(5.8)
    Selection.Tables(1).Cell(i, 4).Width = CentimetersToPoints(1.04)
    Selection.Tables(1).Cell(i, 5).Width = CentimetersToPoints(1.04)
    Selection.Tables(1).Cell(i, 6).Width = CentimetersToPoints(5.49)
Next i
   
Selection.Tables(1).Cell(2, 5).Select

ErrorHandler:
   Resume Next



   
Posted by n3015m
:
BLOG main image
'네오이즘'의 보안LAB 블로그입니다........... n3oism@gmail.com by n3015m

카테고리

분류 전체보기 (228)
[ HappyDevTool ] (29)
[ HappyToolRelease ] (4)
[Book] (6)
[ Security Studies ] (0)
- CII (2)
- BigData (2)
- Web Hacking (10)
- SQL Injection (25)
- Mobile Security (9)
- Network (6)
- OperatingSystem (4)
- Malware & Reversing (4)
- Phishing (5)
- Compliance (0)
- Programming (13)
- Tools (13)
- IoT (6)
- etc (21)
[Pentration Testing] (3)
[OS X] (4)
[ Security Trends ] (16)
[ Fixing Guideline ] (7)
My Way, My Life (34)
About Me (2)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

Total :
Today : Yesterday :