Skip to content

Instantly share code, notes, and snippets.

View Kyeongrok's full-sized avatar

Kyeongrok Kim Kyeongrok

View GitHub Profile
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시트명을 입력해주세요")
    
    '데이터 범위 구하기
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
@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
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"
function myFunction() {
  // 1. 새로 만든 구글 스프레드시트의 인터넷 주소(URL)를 지정
  var url = "새로 만든 구글 스프레드시트 인터넷주소(URL)";
  var spredSheet = SpreadsheetApp.openByUrl(url);
  
  // 2. 날짜 생성하기
  var d = new Date();
  var targetName = Utilities.formatDate( d, 'GMT', 'yyyyMMdd');
  
Sub 다른이름으로저장하기()

    Workbooks.Open Filename:="C:\public\hello1.xlsx"
    ActiveWorkbook.SaveAs Filename:="C:\public\안녕1.xlsx", FileFormat:= _
        xlOpenXMLWorkbook, CreateBackup:=False
    Application.Left = 159.25
    Application.Top = 59.5
 ActiveWindow.Close