SlideShare a Scribd company logo
Excel
        2012/01/23
Excelマクロはじめの一歩
:

^(d{3}[357])(.*?)      (.*?)    (([0-9a-zA-Z ]+?))(.*   )$


12    3    (1_4_3)5


S

([0-9]{3}(3|5|7))>(.*)         (.*)   ((.*))(.*)


1>2    3    (1_4_3)5


T

^([0-9]{3}[357])(..*?         )(..*)(   .*()([0-9a-zA-Z ]*)().*   )$


$1$2$3$4$1_$5_$3$6
Excelマクロはじめの一歩
Excelマクロはじめの一歩
Excelマクロはじめの一歩
[   ]
[   ]
Excelマクロはじめの一歩
[        ]



=>
             /




[    ]
=>
Excelマクロはじめの一歩
Alt+F11           VBA


                  [                ]
      Module1


(         Mac                Win
[             ]             [???????]   )
Sub Macro1()
'
' Macro1 Macro
'
    Range("C3").Select
    ActiveCell.FormulaR1C1 = "foo"

    Columns("D:D").Select
    Selection.Insert _
    Shift:=xlToRight,CopyOrigin:=xlFormatFromLeftOrAbove

    Range("A1").Select

    Cells.Find(What:="foo", After:=ActiveCell, LookIn:=xlFormulas,
    LookAt:= xlPart, SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, MatchCase:=False, _
    MatchByte:=False, SearchFormat:=False).Activate

End Sub

                     1. C3   ”foo”
                     2. D
                     3. “foo”
Sub              (<arg *optional>)


      <         >


End Sub




(                                       )


      : Sub          Function         VBA             xls


          =Foo(A1)                   Function “Foo”
http://www.asahi-net.or.jp/~ef2o-inue/vba_k/
sub04_020.html
Excelマクロはじめの一歩
Excelマクロはじめの一歩
VBA
Dim   i As Integer
Dim   columnInternal As String
Dim   columnInvoicedAmt As Double
Dim   rowNum As Boolean
Dim   tmp As Variant

Dim <      > As <       >




          Option Explicit




http://www.asahi-net.or.jp/~ef2o-inue/vba_k/sub04_040.html
http://www.asahi-net.or.jp/~ef2o-inue/vba_k/sub04_050_06.html
(                     )
   Integer               String

   Long                  Date

   Single                Object

   Double                Variant

   Currency              Boolean




http://excelvba.pc-users.net/fol5/5_2.html
=


a = 100
                a        100
                     a ← 100
          a              100


    i = i + 1
      i                    i    1
 :i = 2             i = i + 1        i = 3



http://home.att.ne.jp/zeta/gen/excel/c04p22.htm
If   (   )
(     )
=:     =:

+:     <>:

-:     >:

*:     >=:

/:     <:

mod:   <=:

^:
if
(if                                 )
If        1 Then
           1
ElseIf          2 Then
           2
Else
           1          2
End If
*ElseIf        Else



http://excelvba.pc-users.net/index.html
   6



http://excelvba.pc-users.net/fol6/6_1.html
http://www.asahi-net.or.jp/~ef2o-inue/vba_k/sub04_050_02.html
:
If Cells(1,1).Value = 1 Then
     Cells(1,2).Value = “Foo”
ElseIf Cells(1,1).Value = 2 Then
     Cells(1,2).Value = “bar”
Else
     Cells(1,2).Value = “hoge”
End If

         Cells(1,1) (    A1)          -
1         Cells(1,2) (    B1)             “Foo”
2         Cells(1,2) (    B1)             “bar”
              Cells(1,2) (      B1)           “hoge”



ElseIf
(                                                      )
For   Next
(      if
              )


For               =   To


Next

        For                          i    j




http://excelvba.pc-users.net/fol6/6_3.html
http://www.sigoto.co.jp/excel/statement/state09.htm
(For each    Next                        )
:
Dim i As Integer

For i = 1 To 10
     Cells(i, 1).Value = i * 10
     i = i + 1
Next



        i   1           i
(                           )
For i = 1 To 10     Next        i    1     10


Cells(i, 1).Value = i * 10          Cells(i, 1)   i*10
i = i + 1       i   1                                    ”   i
+ 1”
Excelマクロはじめの一歩
(   2:30...)
Excelマクロはじめの一歩
xciConvert.xlsm
Alt+F11   VBA


   Before.xls     After.xls
Client          Project Number          Client

Internal %                        %        (+        )

Vendor %                          (+             )

Invoiced Amt       Project Total
      Invoiced Amount    0

Invoiced Amt

GM

Client Name    BU Name       CompDate     BDM

GM%

         :
3
/
Left
http://officetanaka.net/excel/vba/function/Left.htm

InStr
http://officetanaka.net/excel/vba/function/InStr.htm

Offset
http://officetanaka.net/excel/function/function/
offset.htm

CSng
http://officetanaka.net/excel/vba/function/CSng.htm


http://officetanaka.net/excel/vba/function/index.htm
Web
http://officetanaka.net/excel/

http://www.asahi-net.or.jp/~ef2o-inue/menu/
menu04.html

http://www.asahi-net.or.jp/~ef2o-inue/menu/
menu05.html

http://excelvba.pc-users.net/index.html


                     VBA             Web
                                  VBA xxxx
Excelマクロはじめの一歩
Excelマクロはじめの一歩
xciConvert.xlsm


Client                 ProjDate
Client                                  A       B
                    Client


         ProjDate                     Project
Number
netapp_1101_008-02 (              )
Excelマクロはじめの一歩

More Related Content

PPTX
F# intro
PDF
Closure, Higher-order function in Swift
PPTX
4. pointers, arrays
PDF
Introduction to python programming
PDF
Facebook fql and tweepy
DOCX
array implementation
PDF
Functional Programming on Android: is it possible?
PPTX
Dr.nouh part summery
F# intro
Closure, Higher-order function in Swift
4. pointers, arrays
Introduction to python programming
Facebook fql and tweepy
array implementation
Functional Programming on Android: is it possible?
Dr.nouh part summery

What's hot (20)

PDF
C++ Programming - 1st Study
PDF
PostgreSQL Quiz
PPTX
Pegomock, a mocking framework for Go
DOC
Exception Example in Python
PDF
Stl algorithm-Basic types
PPTX
C Programming Language Step by Step Part 5
PDF
変数の型 - Java 演習
PDF
Burrowing through go! the book
PPTX
C Programming Language Part 4
TXT
Code
PDF
20180721 code defragment
PDF
Import data from csv excel file and export to xml excel file in c programming
PDF
20180310 functional programming
PPTX
Basic use of Python
PPTX
How the stack works(1)
PDF
Евгений Курбацкий. Зачем нужны зависимые типы
PDF
Data Structure - 2nd Study
PDF
20181020 advanced higher-order function
PPTX
Integers slidecast
PDF
OREO - Hack.lu CTF 2014
C++ Programming - 1st Study
PostgreSQL Quiz
Pegomock, a mocking framework for Go
Exception Example in Python
Stl algorithm-Basic types
C Programming Language Step by Step Part 5
変数の型 - Java 演習
Burrowing through go! the book
C Programming Language Part 4
Code
20180721 code defragment
Import data from csv excel file and export to xml excel file in c programming
20180310 functional programming
Basic use of Python
How the stack works(1)
Евгений Курбацкий. Зачем нужны зависимые типы
Data Structure - 2nd Study
20181020 advanced higher-order function
Integers slidecast
OREO - Hack.lu CTF 2014
Ad

Viewers also liked (8)

KEY
ピボットテーブル02
KEY
How to use hiatus
KEY
Excelマクロ 2
KEY
正規表現のいろは
KEY
TTX+tools
KEY
ピボットテーブル01
KEY
Rubyスクリプト
PDF
AdvancedなExcel活用講習会
ピボットテーブル02
How to use hiatus
Excelマクロ 2
正規表現のいろは
TTX+tools
ピボットテーブル01
Rubyスクリプト
AdvancedなExcel活用講習会
Ad

Similar to Excelマクロはじめの一歩 (20)

PDF
Excel VBA programming basics
DOCX
Excel Macros and VBA Demo.docx
DOCX
Excel Macros and VBA Demo.docx
PPTX
Excel 2016 VBA PPT Slide Deck - For Basic to Adavance VBA Learning
PPTX
Vba Excel Level 2
PDF
Useful macros and functions for excel
PPTX
Vba Class Level 1
PDF
การบ้านวิชาห้องสมุด
XLS
Huge Collection Of Formulae
DOCX
Ktifkan dulu microsoft visual basic
PDF
Excel vba notesforprofessionals
PPTX
Vba and macro creation (using excel)
DOCX
Loop in excel
PDF
Excel-Quick-Reference-Guide.pdf
DOC
Fast track in excel
PPTX
PPTX
Microsoft excel 2010 useful formula & functions
DOC
PDF
Excel formulas-manual
PDF
MS Excel Overall Power Point Presentatio
Excel VBA programming basics
Excel Macros and VBA Demo.docx
Excel Macros and VBA Demo.docx
Excel 2016 VBA PPT Slide Deck - For Basic to Adavance VBA Learning
Vba Excel Level 2
Useful macros and functions for excel
Vba Class Level 1
การบ้านวิชาห้องสมุด
Huge Collection Of Formulae
Ktifkan dulu microsoft visual basic
Excel vba notesforprofessionals
Vba and macro creation (using excel)
Loop in excel
Excel-Quick-Reference-Guide.pdf
Fast track in excel
Microsoft excel 2010 useful formula & functions
Excel formulas-manual
MS Excel Overall Power Point Presentatio

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
cuic standard and advanced reporting.pdf
PPTX
Machine Learning_overview_presentation.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Spectroscopy.pptx food analysis technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Big Data Technologies - Introduction.pptx
A Presentation on Artificial Intelligence
Programs and apps: productivity, graphics, security and other tools
gpt5_lecture_notes_comprehensive_20250812015547.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
cuic standard and advanced reporting.pdf
Machine Learning_overview_presentation.pptx
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Mobile App Security Testing_ A Comprehensive Guide.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
MIND Revenue Release Quarter 2 2025 Press Release
MYSQL Presentation for SQL database connectivity
Spectroscopy.pptx food analysis technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Big Data Technologies - Introduction.pptx

Excelマクロはじめの一歩

Editor's Notes