Skip to content

Instantly share code, notes, and snippets.

View Kyeongrok's full-sized avatar

Kyeongrok Kim Kyeongrok

View GitHub Profile
Sub main()
    Call 출력_안녕하세요
    Call 출력_안녕히가세요
    Call 출력_메세지("hello")
    Call 출력_누구_메세지("김경록", "bye")
End Sub

'파라메터가 2개인 서브루틴 만들기
Sub 출력_누구_메세지(p_누구, p_메세지)
Private 인터넷익스플로러 As InternetExplorer
Sub main()
   '인터넷 익스플로러 불러오기
   Set 인터넷익스플로러 = CreateObject("InternetExplorer.Application")
   검색어 = WorksheetFunction.EncodeURL("맛집")
   페이지주소 = "https://search.naver.com/search.naver?where=nexearch&sm=top_hty&fbm=1&ie=utf8&query=" & 검색어
   
   인터넷익스플로러.Visible = True
인터넷익스플로러.Navigate2 (페이지주소)
@Kyeongrok
Kyeongrok / advanced_filter.md
Last active August 27, 2017 06:44
excel vba advanced filter
Sub advancedFilter()
    'jdpps
    Sheets("filter").Range("a7:z10000").ClearFormats
    db시트명 = Range("filter!b5").Value
    
    'db시트명 입력 안했으면 메세지(validation)
    If db시트명 = "" Then MsgBox ("fliter!b5 에 db시트명을 입력해주세요")
    
    '데이터 범위 구하기
@Kyeongrok
Kyeongrok / chart_range_di.md
Last active August 6, 2017 05:10
excel vba draw chart
Sub main_chart()
    '차트 지우기
    'Sheets("Sheet1").ChartObjects.Delete
    '65 -> A, 66 -> B, 67 ->c
    For  = 1 To 12
        top_1 =  * 230 - 220
        Call drawChart("Sheet2", "Sheet1!A1:A27,Sheet1!" & Chr(65 + 월) & "1:" & Chr(65 + 월) & "27", top_1)
        Call drawChart("Sheet3", "Sheet1!A1:A27,Sheet1!" & Chr(65 + 월) & "1:" & Chr(65 + 월) & "27", top_1)
 Next
@Kyeongrok
Kyeongrok / loop_print_data.md
Last active August 6, 2017 05:09
excel vba print data for chart
Sub main_print_data()
    Range("a1:z10000").Value = ""
    Range("a1:z10000").ClearFormats
    Call 출력_월
    Call 출력_매장
    Call 출력_데이터
End Sub

Sub 출력_데이터()
Sub main_powerquery()
    For Each qr In ThisWorkbook.Queries
        qr.Delete
    Next qr
    '035420, 035720
    Call powerquery("SK하이닉스", "000660")
    Call powerquery("카카오", "035720")
End Sub
Sub powerquery(p_종목명, p_종목코드)
Sub main_chart()
    Sheets("Sheet1").ChartObjects.Delete
    For  = 1 To 12
        Top =  * 230 - 220
        Call drawChart("Sheet1", _
        "Sheet1!A1:A27,Sheet1!" & Chr(65 + 월) & "1:" & Chr(65 + 월) & "27", Top)
    Next
End Sub
Sub main_webquery()
    Call webQuery
End Sub
Sub webQuery()
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://finance.naver.com/item/sise_day.nhn?code=035720", Destination:= _
        Range("$A$1"))
        .Name = "sise_day.nhn?code=035720_1"
        .FieldNames = True
Sub main_chart()
    '차트 지우기
    Sheets("Sheet1").ChartObjects.Delete
    Call drawChart
End Sub
Sub drawChart()
    Sheets("Sheet1").Select
    ActiveSheet.Shapes.AddChart.Select
 ActiveChart.ChartType = xlColumnClustered
Option Explicit
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private objIE As InternetExplorer
Sub main()
    Set objIE = New InternetExplorer
    Dim url
    Dim baseUrl

    baseUrl = "https://play.google.com"