Pravljenje Makro-a. 1. Na Developer tab, kliknite Insert. 2. U ActiveX Controls group, kliknite Command Button. 3. Prevucite dugme na vaš radni papir.

Similar documents
Postojeći Mail Account u Outlook Expressu (podešavanje promjena):

Podešavanje klijenata

Postupak konfiguracije ADSL modema ZTE u Routed PPPoE modu Detaljni opis konfiguracije

1. a procedure that you perform frequently. 2. Create a command. 3. Create a new. 4. Create custom for Excel.

Working with Macros and VBA in Excel 2007

Uputstva za HTC. Sadržaj : 1. HTC HD HTC Snap HTC Smart HTC Legend HTC Desire HTC Magic 10

Ako je Local Area Connection u stanju Disabled, kao na slici, desnim tasterom miša kliknemo na ikonicu i odaberemo lijevim tasterom opciju Enable.

Uputstvo za povezivanje na IPv6 mrežu

Word 2010: Mail Merge to with Attachments

Financial Data Access with SQL, Excel & VBA

To create a histogram, you must organize the data in two columns on the worksheet. These columns must contain the following data:

Slika 2. Other. Hardware

Excel & Visual Basic for Applications (VBA)

Programming in Access VBA

Automate tasks with Visual Basic macros

Excel macros made easy

MS WORD 2007 (PC) Macros and Track Changes Please note the latest Macintosh version of MS Word does not have Macros.

Microsoft VBA Programming

Macros in Word & Excel

Writing Macros in Microsoft Excel 2003

Siemens Applied Automation Page 1 11/26/03 9:57 PM. Maxum ODBC 3.11

Highline Excel 2016 Class 26: Macro Recorder

DATA 301 Introduction to Data Analytics Microsoft Excel VBA. Dr. Ramon Lawrence University of British Columbia Okanagan

SPV Reporting Tool VBA Code User Guide. Last Updated: December, 2009

Microsoft Office Access 2007 Basics

Tommy B. Harrington 104 Azalea Drive Greenville, NC

Explore commands on the ribbon Each ribbon tab has groups, and each group has a set of related commands.

RIT Installation Instructions

INTRODUCTION 5 COLLABORATION RIBBON 5 SELECT THE UPDATING METHOD 6 MAKE YOUR PROJECT COLLABORATIVE 8 PROCESSING RECEIVED TASK UPDATES 9

Lean Product Lifecycle Management Approach

Chapter 4 Displaying and Describing Categorical Data

VBA PROGRAMMING FOR EXCEL FREDRIC B. GLUCK

Sadržaj. Sadržaj Uvod u Microsoft PowerPoint Prikazivanje galerija Korišćenje dodatnih opcija...

Part A: Introduction to Excel VBA

Microsoft Excel 2013: Macro to apply Custom Margins, Titles, Gridlines, Autofit Width & Add Macro to Quick Access Toolbar & How to Delete a Macro.

Excel 2007 Introduction to Macros

Excel Programming Tutorial 1

Excel Reports and Macros

LabVIEW Report Generation Toolkit for Microsoft Office

Call Centre Helper - Forecasting Excel Template

USC Marshall School of Business Marshall Information Services

Construction Administrators Work Smart with Excel Programming and Functions. OTEC 2014 Session 78 Robert Henry

Task Force on Technology / EXCEL

P R E M I E R. Microsoft Excel 2007 VBA (Macros) Premier Training Limited 4 Ravey Street London EC2A 4QP Telephone +44 (0)

Computer Skills: Levels of Proficiency

Introduction to Microsoft Access 2003

Basics. a. Click the arrow to the right of the Options button, and then click Bcc.

Using Excel and VBA CHANDAN SENGUPTA SECOND EDITION. WILEY John Wiley & Sons, Inc.

Training Needs Analysis

Applications Development

How to prepare Microsoft Outlook 2010 for Dial from Outlook - Windows Phone Application

Excel & Visual Basic for Applications (VBA)

LabVIEW Report Generation Toolkit for Microsoft Office User Guide

Overview of sharing and collaborating on Excel data

Overview... 2 How to Add New Documents... 3 Adding a Note / SMS or Phone Message... 3 Adding a New Letter How to Create Letter Templates...

Microsoft Access 2010 handout

Microsoft Office Macros. Presentation Conventions

Migrating to Excel 2010 from Excel Excel - Microsoft Office 1 of 1

Integrating Microsoft Word with Other Office Applications

Basic Microsoft Excel 2007

Naša Škola Upustvo za upotrebu- Verzija 1.0

ECDL. European Computer Driving Licence. Spreadsheet Software BCS ITQ Level 2. Syllabus Version 5.0

ADVANTAGES AND LIMITATIONS OF THE DISCOUNTED CASH FLOW TO FIRM VALUATION

Creating Web Pages With Dreamweaver MX 2004

Risø-R-1551(EN) Wilmar Deliverable D6.2 (a) Wilmar Planning Tool User guide. Helge V. Larsen

To Begin Customize Office

Fig. 1 The finished UserForm project.

Professional Fire Software Control Center. Fire Training Module Training Manual

In this example, Mrs. Smith is looking to create graphs that represent the ethnic diversity of the 24 students in her 4 th grade class.

Here is a Trial Balance sample, generated and exported into an Excel spreadsheet, by an accounting software*

Microsoft Excel 2013: Using a Data Entry Form

Microsoft Access 2010 Part 1: Introduction to Access

What is a Mail Merge?

Pregled svake od ovih uputa moguć je korištenjem veze koja se nalazi na nazivu pojedinog privitka.

The Linux Small Business Server

Hands-on Exercise 1: VBA Coding Basics

Knowledgebase Article

Sitecore is a trademark of Sitecore A/S. All other brand and product names are the property of their respective holders.

To add a data form to excel - you need to have the insert form table active - to make it active and add it to excel do the following:

Programming Excel Macros

This chapter is completely devoid of any hands-on training material. It

Microinvest Warehouse Pro Light Restaurant is designed to work in tandem with Microinvest Warehouse Pro which provides all back office functions.

EXCEL VBA ( MACRO PROGRAMMING ) LEVEL SEPTEMBER AM-5.00PM MENARA PJ@AMCORP PETALING JAYA

MICROSOFT EXCEL 2011 MANAGE WORKBOOKS

Easy Map Excel Tool USER GUIDE

MICROSOFT ACCESS 2003 TUTORIAL

Excel Reporting with 1010data

Hummingbird Enterprise

To change title of module, click on settings

Part 1: An Introduction

DISCRETE MATHEMATICS AND ITS APPLICATIONS IN NETWORK ANALYSIS DISKRETNA MATEMATIKA I NJENE PRIMJENE U MREŽNOJ ANALIZI

Add an Audit Trail to your Access Database

GlobalSign Solutions. Using a GlobalSign PersonalSign Certificate to Apply Digital Signatures in Microsoft Office Documents

Database Concepts (3 rd Edition) APPENDIX D Getting Started with Microsoft Access 2007

Getting Started. Tutorial RIT API

EXAMPLE WITH NO NAME EXAMPLE WITH A NAME

Basic Pivot Tables. To begin your pivot table, choose Data, Pivot Table and Pivot Chart Report. 1 of 18

COPYRIGHTED MATERIAL. The Excel macro recorder User-defined functions The Excel Object Model VBA programming concepts

Computer Applications (10004)

A Microsoft Access Based System, Using SAS as a Background Number Cruncher David Kiasi, Applications Alternatives, Upper Marlboro, MD

Transcription:

Uvod u VBA

Pravljenje Makro-a Sa Excel VBA moguće je automatizovati rad u Excelu pisanjem makroa (macro) Napravićemo jednostavan makro koji se izvršava pritiskanjem dugmeta Kao prvo potrebno je omogućiti Developer tab

Pravljenje Makro-a

Pravljenje Makro-a 1. Na Developer tab, kliknite Insert. 2. U ActiveX Controls group, kliknite Command Button. 3. Prevucite dugme na vaš radni papir.

Dodeljivanje Makro-a 1. Desni klik CommandButton1 (proverite da je Design Mode uključen). 2. kliknite View Code.

Dodeljivanje Makro-a 3. Postavite kursor između Private Sub CommandButton1_Click() i End Sub. 4. Dodajte kod sa slike

Dodeljivanje Makro-a 5. Zatvorite Visual Basic Editor. 6. Kliknite na komandno dugme na radnom papiru (pazite da je Design Mode isključen).

Dodeljivanje Makro-a

Zamena vrednosti Prvo, određujemo varijablu koja se zove temp tipa Double. Dim temp As Double Drugo, pokrenemo temp sa vrednošći ćelije A1. temp = Range("A1").Value Teće, sada možemo da upišemo vrednost ćelije B1 u ćeliju A1 (sačuvali smo vrednost ćelije A1 u temp kako je ne bi izgubili). Range("A1").Value = Range("B1").Value Konačno možemo zapisati vrednost ćelije A1 (u temp) u ćeliju B1. Range("B1").Value = temp Kliknite komandno dugme 2 puta. Result:

As a beginner to Excel VBA, you might find it difficult to decide where to put your VBA code. The Create a Macrochapter illustrates how to run code by clicking on a command button. This example teaches you how to run code from a module. 1. Open the Visual Basic Editor. 2. Click Insert, Module.

3. Create a procedure (macro) called Cyan. Sub Cyan() End Sub Sub menja pozadisku boju vašeg radnog papira u cyan. Kako bi se ovo postiglo mora se dodati ovaj kod. Cells.Interior.ColorIndex = 28 Umesto ColorIndex number 28 (cyan), možete koristit bilo koji ColorIndex broj. Kako bi se obavi ovaj proces izvršiti sledeće korake:

Rezultat Može da se primeni na ceo excel dokument

Snimanje Makroa Macro Recorder je veoma koristan alat koji se nalazi Excel VBA, koji snima svaki korak rada u Excelu. Sve što je potrebno jeste da se određeni postupak snimi jednom. Dalje se isti postupak može ponoviti neograničen broj puta. Macro Recorder je veoma koristan alat ukoliko korisnik ne zna da isprogramiran određeni postupak u Excel VBA. Jednostavno otvorite Visual Basic Editor nakon snimanja kako bi se uvideo postupak programiranja koji ste snimili. Na žalost postoji dosta ograničenja u dadu sa Macro Recorder. Na primer ne može se obavljati cikličan proračun raspona podatak pomoću Macro Recorder. Dalje, Macro Recorder koristi mnogo više koda nego što je to potrebno, što može usporiti kompleksnije proračune.

Snimanje Makroa Na Developement tabu, kliknite Record Macro

2. Unesite ime. 3. Odabrite Workbook sa opadajuće liste. Kao rezultat, macro će biti jedino dostupan u trenutnom workbooku.

Ako sačuvate makro u Personal Macro Workbook, macro će bidi dostupan u svim vašim Excel fajlovima. Ovo je moguće jer Excel čuva vaše macroe u skrivenom dokumentu (workbook) koji se automatski otvara kada se startuje Excel. Ako sačuvate vaš macro u New Workbook, macro će biti jedino dostupan u novom dokumentu koji će se automatski otvoriti.

4. Kliknite OK. 5. Desnim klikom kliknite na aktivnu ćeliju (selektovana ćelija). Budite sigurni da niste selektovali ni jednu drugu ćeliju! Dalje kliknite Format Cells.

6. Odaperite Percentage 7. Kliknite OK.

8. Kliknite Stop Recording

Pokrenite snimljeni makro 1. Unesite neke vrednosti između 0 i 1. 2. Selektujte brojeve

Developer tab, click Macros.

Pogledajte makro

Apsolutne i relativne reference Bez dodatne napomene Excel smina makroe u apsolutnom modu. Nekada je korisno da se makro snimi u relativnom modu Snimanje u Absolute Mode Da bi se makro snimio u apsolutnom modu uradite sledeće: 1. click Record Macro. 2. Dalje, selektujte ćeliju B3. Napišite Sales i stisnite enter. 3. Napišite Production i stisnite enter. 4. Napišite Logistics i stisnite enter.

5. Click Stop Recording. 6. Obrišite ("B3:B5"). 7. Odaberite bilo koju ćeliju na papiru i pokrenite vaš makro.

Makro snimljen u apsolutnom modu uvek daje isti rezultat

Snimanje u relativnom modu 1. selektujte "Use Relative References". 2. Dalje slektujte bilo koju ćeliju 3. Kliknite na Record Macro 4. Napišite Sales i stisnite enter. 5. Napišite Production i stisnite enter. 6. Napišite Logistics i stisnite enter.

Click Stop Recording

Selektujte bilo koju drugu ćeliju (npr, cell D4) i pokrenite snimljeni makro macro. Rezultat:

FormulaR1C1 Ivaj primer ilustruje razliku između A1, R1C1 and R[1]C[1] stila u Excel VBA. Postavite komandno dugme na vaš list i dodajte kod (A1 stil): Range("D4").Formula = "=B3*10"

2. Dodajte sledeću liniju koda (R1C1 stil): Range("D4").FormulaR1C1 = "=R3C2*10"

2. Dodajte sledeću liniju koda (R[1]C[1] stil): Range("D4").FormulaR1C1 = "=R[-1]C[-2]*10" Relativna referenca

Dodavanje makroa na Toolbar

Nazovite makro MyName. Odaberite da sačuvate makro kao Personal Macro Workbook.

Otvorite Visual Basic Editor. 5. napravite macro: Makro Stavlja vaše ime u aktivnu ćeliju.

Macro sigurnost

MsgBox The MsgBox is a dialog kućica u Excel VBA kojim se korisnik može informisati o radu programa. Postaviti DUGME u vaš excel i dodajte mu komandu: Jednostana poruka. MsgBox "This is fun"

MsgBox Napredna poruka. Prvo, uneti vrednost u ćelju A1. MsgBox Uneta vrednost je" & Range("A1").Value

MsgBox Ukoliko se želi uneti navi red u MsgBox, koristi se vbnewline. MsgBox "Line 1" & vbnewline & "Line 2" Rezultat kada se klikne na dugme: