Index

Numerics

3D models, 575

24-hour time, 117118

A

A1 addressing, 87, 8991, 9495

above/below average rules, 340, 355. See also conditional formatting

absolute references, R1C1 addressing and, 9293

Access

creating a shared database, 449450

database

adding records to a, 452453

deleting records via ADO, 458

retrieving records from, 453455

summarizing records via ADO, 458459

updating an existing record, 455458

MDB (multidimensional database) files, 447448

reading from, 451

tables

adding fields on the fly, 462463

adding on the fly, 461462

checking for the existence of, 460

checking for the existence of a field, 461

operations, 451

ACE engine, 447448

ActiveX controls

minimizing duplicate code, 147148

running a macro with, 536

AddAboveAverage method, 355

.AddChart2 method, 313, 314315, 318319, 337338

adding

color scales to a range, 346347

data bars to a range, 342346

icon sets to a range, 347350

names, 98100

add-ins, 539

Excel

characteristics of, 539540

closing, 545

converting workbooks to, 540541

creating with VB Editor, 542543

hidden workbook as an alternative, 545547

installing, 543544

removing, 545

saving files as, 541542

security, 544545

Office, 549

adding interactivity, 554557, 559560

defining, 558559

Hello World, 550, 551554

JavaScript and, 569570

writing to the content or task pane, 569

AddTop10 method, 355

AddUniqueValues method, 356358

ADOs (ActiveX Data Objects), 448

adding tables on the fly, 461462

checking for the existence of a field, 461

checking for the existence of a table, 460

connection, 450, 451

cursor, 450451

deleting records from an Access database, 458

lock type, 451

record set, 450

summarizing records via, 458459

Advanced Filter, 183

building, 184

criteria ranges and, 191192, 193

extracting a unique list of values, 185

changing the list range to a single column, 185

copying the customer heading before filtering, 185186

Filter In Place, 201

catching no records, 201202

showing all records, 202

formula-based conditions, 194195

returning above-average records, 200

using in the Excel user interface, 195196

using with VBA, 196200

joining multiple criteria

with a logical AND, 193

with a logical OR, 192

replacing a list of values with a condition created from a formula, 193194

retrieving unique combinations of two or more fields, 190

xlFilterCopy, 202

combining multiple techniques, 205209

copying a subset of columns and reordering, 203205

copying all columns, 202203

alpha characters, sorting, 301303

API (Application Programming Interface), 491. See also Spotify

declarations, 492

32-bit- and 64-bit-compatible, 493494

private, 492

using, 493

functions

checking whether an Excel file is open on a network, 495496

creating a running timer, 498499

customizing the About dialog box, 497

disabling the X for closing a user form, 498

playing sounds, 499

retrieving display-resolution information, 496497

retrieving the computer name, 495

getting credentials for accessing, 386387

applications, events, 120124

setting up a class module, 134

trapping, 134135

Archibald, R., 260

Areas collection, 66

arrays, 125, 145

declaring, 125126

dynamic, 130131

filling, 127128

formulas, 573

JavaScript, 562563

multidimensional, declaring, 126127

names and, 104

passing, 131132

retrieving data from, 128129

speeding up code with, 129130

assigning, macros

to a form control, 1213

to an object, 13

AutoFilter

filtering

by color, 179

by icon, 179180

replacing loops with, 175178

selecting a dynamic date range, 180181

selecting multiple items, 178179

selecting using the Search box, 179

turning off drop-down menus, 209210

AutoSort method, 226

Autosum button, 2425, 26

B

backward compatibility, .AddChart2 method, 337338

Barresse, Z., 263, 278

Excel Tables: A Complete Guide for Creating, Using, and Automating Lists and Tables, 67

barriers to learning VBA, 2. See also learning VBA

BASIC, 2, 28

binding. See early binding; late binding, 499

blocks, With…End With, 50

bookmarks, 441442

BookOpen() function, 288289

borders, chart, 331

breakpoints, 40, 41

backing up or moving forward, 40

querying

by hovering, 42

using a Watches window, 4243

using the Immediate window, 4142

setting with watches, 43

Bricklin, D., 87

building

advanced filters, 184

Data Model, 247249

LAMBDA functions, 307308

pivot tables, 245246, 255256

UDFs (user-defined functions), 286287

buttons

Autosum, 2425, 26

command, 160, 161162

command, running a macro with, 534535

creating, 557558

Help, 576

option

adding to a userform, 165166

events, 166

spin, 168169

toggle, 471472

using images on, 527

C

calculated fields, 249250

calculated items, 250

.Calculation property, 223

calculations, changing to show percentages, 223225

calling, userforms, 156

canceling a scheduled macro, 408

Case statement, complex expressions in, 84

cell pointer, 2021, 23

cells

creating a progress indicator, 274275

duplicate, marking, 356358

empty, 6263, 226

formatting, 243244

based on their value, 358

that contain blanks or errors, 359

that contain dates, 359

that contain text, 358359

using a formula, 359361

notes, placing charts in, 265267

returning the column letter of an address, 305306

selecting visible only, 181182

Cells property, referencing ranges with, 5758

ChartFormat object, 327

charts, 313, 574. See also sparklines

applying a color, 320321

borders, 331

combo, 331334

creating

macro recorder and, 318

using .AddChart2 method, 314315

embedded, events, 118120

events, 118, 136137

exporting as a graphic, 337

filtering, 322

formatting, 327328

line settings, 331

map, creating, 335

placing in a cell note, 265267

referring to, 318319

SetElement method, 323327

sheet events, 119120

specifying a title, 319320

styles, 315318

trendline, formatting, 331

waterfall, creating, 336337

win/loss, formatting, 377378

check boxes, 165, 466468

class modules, 133

application events, trapping, 134135

clsCtlColor, 485486

collections, creating, 142144

custom objects

creating, 137139

using, 139140

embedded chart events, trapping, 136137

Excel state, 268270

inserting, 133134

minimizing duplicate code for ActiveX labels, 147148

clauses

Step, 7273

Until, 7779

While, 7779

cleaning up code, 4552

Close method, 436437

closing, add-ins, 545

code. See also M; XML

adding to new workbooks, 279280

breakpoints, 40

cleaning up, 4552

comments, 18

duplicate, minimizing, 147148

early binding, referencing a Word object, 427430

examining, 1719, 3334

Help topics, 37

JavaScript, 560561

late binding, referencing a Word object, 430

picture catalog userform, 481483

pivot tables

building with a timeline, 243

building with two slicers, 238240

creating a Data model, 247249

creating a static summary from, 218219

generating, 216217

producing one report per product, 227229

protecting, 513514

speeding up with arrays, 129130

Step Into feature, 3840

stepping through, 4041. See also breakpoints

streamlining, 46

TypeScript, creating a pivot table, 255

VBA, 27

collection(s), 29, 140

Areas, 66

controls and, 473475

creating, 140141

in a class module, 142144

in a standard module, 141142

dictionaries and, 145

FormatConditions, 340341

ColName() function, 305306

color(s)

adding to fields in a userform, 485486

applying

to a chart, 320321

to data bars, 343, 344345, 352354

to objects, 329

filtering by, 179

RGB, applying to sparklines, 373374

scales, 339, 346347

theme, applying to sparklines, 369372

Columns property, 61

combining

forms, 169171

workbooks, 262263

combo boxes, 162163, 164165

combo charts, creating, 331334

command buttons, 160

events, 161162

running a macro with, 534535

comments, 18

HTML, 557

JavaScript, 556, 561

names and, 100

XML, 519

comparing, VBA and TypeScript, 253255

concatenation, 300301

conceptual filter, 230231

conditional formatting, 340341

above/below average rules, 355

data bars, 352354

icons sets, 351352

marking unique or duplicate cells, 356358

NumberFormat property, 361362

top/bottom rules, 355356

using a formula, 359361

conditions, 81

formula-based

returning above-average records, 200

using in the Excel user interface, 195196

using with VBA, 196200

formulas-based, 194195

configuration, pivot table, 213214

constants

Help topics, 35

icon sets, 348349

retrieving the real value of

using the Object Browser, 433434

using the Watches window, 433

SetElement method, 323327

values, 433

xlColumnDataType, 416417

ContainsText() function, 303304

controls

accelerator keys, 483484

adding

on the fly, 479

at runtime, 477478

adding to a ribbon, 520

attributes, 521525

bug fix when adding to a form, 159

check boxes, 466468

collections and, 473475

combo boxes, 162163, 164165

command buttons, 160, 161162

early binding, New keyword, 430431

frames, 474, 475

graphic, 167

labels, 159, 161162

list boxes, 162163

events, 164165

multicolumn, 486487

MultiSelect property, 163164

MultiPage, 169171, 468

option buttons, 165166

ProgIds, 480

programming, 158159

RefEdit, 470471

renaming, 159

scrollbars, 472473

spin buttons, 168169

tab strips, 468470

text boxes, 160, 161162

tip text, adding to userforms, 484

toggle button, 471472

ConvertWeekDay() function, 299300

copy and paste, 49. See also xlFilterCopy

Copy method, 49

CopyFromRecordSet method, 453, 455

Count function, 221

COUNTIF function, 360

counting, unique functions, 296

CreateObject function, 431

CreatePivotTable method, 213214

creating

cell progress indicator, 274275

charts

combo, 331334

map, 335

using .AddChart2 method, 314315

waterfall, 336337

collections, 140141

in a class module, 142144

in a standard module, 141142

custom objects, 137139

custom properties, 148151

dashboards, 378, 379383

Data Model, 247249

macro button

on the Quick Access Toolbar, 1112

on the ribbon, 1011

new instances of objects, 431

pivot tables in VBA, 212

adding fields to the data area, 214217

configuration, 213214

defining the pivot cache, 213

shared Access database, 449450

sparklines, 363365, 379383

UDFs (user-defined functions), 285

userforms, 155156

criteria

complex ranges, 193

logical AND, 193

logical OR, 192

ranges, 191192

replacing a list of values with a condition created from a formula, 193194

CSS (Cascading Style Sheets), 558

CSV files

importing and deleting, 260

opening, 417419

CurrentRegion property, selecting ranges with, 63

custom objects

creating, 137139

using, 139140

custom properties, creating, 148151

D

DAOs (data access objects), 448

dashboards

creating, 378

creating individual sparklines in, 379383

placing query results on, 398401

data bars, 339

adding to a range, 342346

color, applying, 344345

using two colors in a range, 352354

Data Model, 244

creating, 247249

loading large files to, 423424

tables

adding, 244245

creating a relationship between, 245

data sets, converting fixed-width reports to, 280283

data visualizations, 252253, 339

above/below average rules, 340

color scales, 339

conditional formatting, 340341

data bars, 339

highlight cells, 340

icon sets, 340

top/bottom rules, 340

date(s)

converting week number to, 299300

dynamic filters and, 180181

grouping to months, quarters, or years, 221223

of last save, retrieving, 292

retrieving, 292293

debugging tools

breakpoints, 40, 41

backing up or moving forward, 40

queries and, 4143

Step Into feature, 3841

declaring

arrays, 125127

UDTs (user-defined types), 149

Delete method, 100

deleting, names, 100

delimited files, opening, 417419

Design tab, changing the layout, 250251

Developer tab

Add-ins group, 4

Code group, 4

Controls group, 4

Disable All Macros with Notification setting, 8

displaying, 34

macro settings, 78

Modify group, 4

Relative References, 2124

XML group, 4

dialog boxes

Advanced Filter, 184

File Open, 173174

Go To Special, 64, 201

loops and, 182183

Visible Cells Only option, 181182

Name Manager, 97

Record Macro, filling out, 910

Show Values As tab of the Value Field Settings, 223

dictionaries, 145146

DIM statement, 7980

displaying, Developer tab, 34

DLLs (Dynamic Link Libraries), 491

Document object, 435437

Do…loops, 7577

stopping, 77

While and Until clauses, 7779

drilling-down a pivot table, 270271

duplicate

cells, marking, 356358

code, minimizing, 147148

values, 340

dynamic arrays, 130131

dynamic filters, 180181

E

early binding

New keyword, 430431

referencing a Word object, 427430

email, validating an address, 293295

embedded charts, events, 118120, 136137

empty cells, 6263, 226

enabling, events, 113

End+down arrow shortcut, 4748

EndKey method, 437

error handling, 501503

client training and, 509510

custom ribbon and, 529533

Debug mode, 510

encountering errors on purpose, 509

On Error GoTo syntax, 505506

Excel versions and, 515516

generic, 506

ignoring errors, 506507

message boxes and, 509

misleading errors, 503504

page setup, 507508

Power Query, 403

protecting code and, 513514

runtime error 9, 511512

runtime error 1004, 512513

suppressing Excel warnings, 508

events, 112

application, 120124

setting up a class module, 134

trapping, 134135

Change, 267

chart, 118

embedded, 118120

trapping, 136137

check box, 467468

combo box, 164165

command button, 161162

enabling, 113

graphic control, 167

label, 161162

levels of, 111112

list box, 164165

MultiPage, 171

option button, 166

parameters, 112113

QueryClose, 172

RefEdit control, 470471

scrollbar, 473

sheet

chart-level, 119120

workbook-level, 115116

spin button, 169

tab strip, 469470

text box, 161162

toggle button, 471472

userform, 157158

workbook, 113115

worksheet, 116117

Excel. See also ribbon

add-ins

closing, 553

converting workbooks to, 550551

creating with VB Editor, 551552

hidden workbook as an alternative, 554555

installing, 552

removing, 554

saving files as, 551

security, 553

Compatibility mode, 576

Developer tab

Add-ins group, 4

Code group, 4

Controls group, 4

Disable All Macros with Notification setting, 8

displaying, 34

macro settings, 78

Modify group, 4

XML group, 4

error handling, 501503

Help button, 576

Point mode, 185

purchasing, 571

Quick Analysis tool, 573

Ready mode, 407

RELS file, 525526

single-document interface, 572573

updates, scheduling, 407

versions, 571

error handling and, 515516

pivot table evolution, 211212

.xlsm files, 525

Excel8CompatibilityMode property, 577578

Execute method, 458

Exists method, 146

Exit For statement, 7374

exporting

charts as a graphic, 337

to an XML file, 264265

expressions

Case statement and, 84

text, 83

watches and, 4243

extracting a unique list of values

with the user interface, 185186

with VBA code, 186189

F

fields

active, coloring, 485486

adding on the fly, 462463

adding to the pivot table data area, 214217

calculated, 249250

checking for the existence of via ADOs, 461

form, controlling in Word, 443444

protected password box, 275277

file

operations, 257

exporting data to an XML file, 264265

importing and deleting a CSV file, 260

listing files in a directory, 257260

reading a text file into memory and parsing, 260261

types

.xlsm, 5

macro-supported, 45

File Open dialog box, 173174

Filter In Place, 201

catching no records, 201202

showing all records, 202

filtering, 229

filters

chart, 322

conceptual, 230231

manual, 229230

OLAP pivot table, 271273

search, 234236

ShowDetail property and, 250

slicers, 237241

Timelines, 241243

types, 232234

FirstNonZeroLength() function, 296297

fixed-width reports, converting to a data set, 280283

flow control. See also loops

conditions, 81

If-Else If-End If construct, 8283

If-Then-Else construct, 81

If-Then-Else-End If construct, 82

If-Then-End If construct, 82

Select Case construct, 8384

For…Each loops, 79

For…Next loops, 6971

Step clause, 7273

using variables in the For statement, 72

Format method, 327328

Format tab, 327328

Shape Fill drop down, 328330

FormatConditions collection, 340341

formatting. See also conditional formatting

cells, 243244

based on their value, 358

that contain blanks or errors, 359

that contain dates, 359

that contain text, 358359

using a formula, 359361

charts, 327328

conditional, 340341

line settings, 331

resetting on tables, 278279

sparklines, 369

elements, 374377

using RGB colors, 373374

using theme colors, 369372

win/loss charts, 377378

forms, 160

combining, 169171

controls. See also controls

assigning a macro to a, 1213

bug fix when adding to a form, 159

combo boxes, 162163

command buttons, 160

graphic, 167

labels, 159

list boxes, 162163, 164165

MultiPage, 169171

option buttons, 166

programming, 158159

renaming, 159

spin buttons, 168169

text boxes, 160

fields, controlling in Word, 443444

getting a file name, 173174

illegal window closing, 172

retrieving information from, 160161

transparent, setting up, 487488

verifying field entry, 171

Formula property, 352354

formula-based conditions, 194195

returning above-average records, 200

using in the Excel user interface, 195196

using with VBA, 196200

formulas

A1 addressing, 87, 8991

array, 573

conditional formatting and, 359361

controls, combo boxes, 164165

naming, 101

R1C1 addressing, 49, 87, 90, 91

absolute references, 9293

mixed references, 93

referring to entire columns or rows, 93

relative references, 9192

remembering column numbers associated with column letters, 9596

replacing A1 formulas with, 9495

toggling to, 88

frames, 474, 475

Frankston, B., 87

functions

API

checking whether an Excel file is open on a network, 495496

creating a running timer, 498499

customizing the About dialog box, 497

disabling the X for closing a user form, 498

playing sounds, 499

retrieving display-resolution information, 496497

retrieving the computer name, 495

building in Power Query, 390393

Count, 221

COUNTIF, 360

CreateObject, 431

GetObject, 431432

InputBox, 153154

IsEmpty, 6263

JavaScript, 560561

LAMBDA, 307, 573

building, 307308

sharing, 308

SLUGIFY.PLUS(), 309310

TOC2HTML(), 310311

MsgBox, 154155

NOW, 292

recursive, 290

RGB, 373374

SUM, 25

user-defined, 285, 304305

BookOpen(), 288289

building, 286287

ColName(), 305306

ContainsText(), 303304

ConvertWeekDay(), 299300

creating, 285

DateTime(), 292293

FirstNonZeroLength(), 296297

GetAddress(), 305

IsEmailValid(), 293295

LastSaved(), 292

MSubstitute(), 297298

NumUniqueValues(), 296

RetrieveNumbers(), 298299

sharing, 288

SheetExists(), 289291

SortConcat(), 300301

SumColor(), 295

WinUserName(), 291292

VLOOKUP, 107

XLOOKUP, named ranges and, 107109

G

GetAddress() function, 305

GetObject function, 431432

global

names, 9798

variables, 402

Go To Special dialog box, 64, 201

loops and, 182183

Visible Cells Only option, 181182

Gonzàlez Ruiz, J. P., 268

gradients, applying to objects, 330

graphic controls, 167

grouping, dates, 221223

H

Help topics, 3234

code and, 37

constants, 35

optional parameters, 3435

properties and, 38

ToolTips and, 42

Hide method, 156157

hiding

names, 106

userforms, 156157

HomeKey method, 437

HTML, 557

comments, 557

tags, 557

hyperlinks

returning the address, 305

running a macro from, 537

userforms and, 476477

I

icon(s), 340, 575

filtering by, 179180

plus sign, 322323

Restore Down, 39

sets, adding to a range, 347348, 351352

constants, 348349

specifying an icon set, 348349

specifying ranges for each icon, 350

Stop Recording, 10

using on the ribbon, 527529

If statements, nesting, 8486

If-Else If-End If construct, 8283

If-Then-Else construct, 81

If-Then-Else-End If construct, 82

If-Then-End If construct, 82

images, adding to userforms on the fly, 480481

Immediate window (VB Editor), 35, 4142

importing

CSV files, 260

text files, 413

input boxes, 153154

InsertLines method, 280

installing, add-ins, 543544

Intersect method, 62

IsEmailValid() function, 293295

IsEmpty function, 6263

J

JavaScript

adding interactivity to Office add-ins, 559560

arrays, 562563

comments, 561

custom functions, 549

For each...next statement, 565566

functions, 560561

if statements, 564

for loops, 563

math functions, 567568

Office add-ins and, 569570

operators, 566567

Select Case construct, 564565

strings, 562

variables, 561

Jet engine, 448

joining, ranges, 62

Jones, K., 263

Excel Tables: A Complete Guide for Creating, Using, and Automating Lists and Tables, 67

K

Kaji, M., 260

Kapor, M., 87

keyboard shortcuts. See shortcut(s)

keywords

New, 430431

Preserve, 131

Klann, D., 275

L

labels, 159, 161162

LAMBDA functions, 307, 573

building, 307308

sharing, 308

SLUGIFY.PLUS(), 309310

TOC2HTML(), 310311

Lanzo, L., 264

late binding, 145, 430

layout

pivot table, 250251

report, 251

learning VBA, 3

barriers

macro recorder, 2

syntax, 2

line settings, trendline, 331

LineFormat object, 331

list boxes, 162163

events, 164165

multicolumn, 486487

MultiSelect property, 163164

Load method, 156

loading large files to the Data Model, 423424

local names, 9798, 104

logical AND, 193

logical OR, 192

loops, 69

Do, 7577

stopping, 77

While and Until clauses, 7779

exiting early, 7374

For…Each, 79

For…Next, 6971

Step clause, 7273

using variables in the For statement, 72

Go To Special dialog box and, 182183

JavaScript, 563

M, 402

If-then logic, 403404

List.Generate, 404406

nesting, 7475

replacing with AutoFilter, 175178

While...Wend, 79

Lotus 1–3, 24, 87

M

M, 385

global variables, 402

loops, 402

If-then logic, 403404

List.Generate, 404406

searching Spotify for an artist, 388389

macro button, creating

on the Quick Access Toolbar, 1112

on the ribbon, 1011

macro recorder

absolute references, 1920

charts and, 318

relative references, 2024

shortcomings of, 1516

tips for using, 2526

macros. See also code

assigning

to a form control, 1213

to an object, 13

attaching

to an ActiveX control, 536

to a shape, 535

canceling, 408

copying to new workbooks, 279280

passwords and, 515

recording, 89

running, 10

from a hyperlink, 537

using a keyboard shortcut, 533534

scheduling, 407, 408411

searching Spotify database for an artist, 400

security, 6

adding a trusted location, 67

Disable All Macros with Notification setting, 8

enabling outside trusted locations, 78

supported file types, 45

testing, 19, 2223

manual filter, 229230

map charts, creating, 335

matrix, 126

MDB (multidimensional database) files, 447448

message boxes, 154155

methods, 28

AddAboveAverage, 355

.AddChart2, 313, 318319

backward compatibility, 337338

creating charts with, 314315

AddTop10, 355

AddUniqueValues, 356358

AutoFilter, 176177

AutoSort, 226

Close, 436437

Copy, 49

CopyFromRecordSet, 453, 455

CreatePivotTable, 213214

Delete, 100

EndKey, 437

Execute, 458

Exists, 146

Format, 327328

Hide, 156157

HomeKey, 437

InsertLines, 280

Intersect, 62

Load, 156

Modify, 343

OneColorGradient, 330

OnTime, 406407

Open, 436

parameters, 2931

.Patterned, 330

PresetGradient, 330

PresetTextured, 329

PrintOut, 437

SaveAs2, 436

Select, 38

SelectAll, 474

SetElement, 322327

.SetSourceData, 313

SparklineGroups.Add, 363

SpecialCells, 6466, 201

selecting with, 277278

TwoColorGradient, 330

TypeText, 437438

Union, 62

UnselectAll, 474

UserPicture, 329

Miles, T., 261, 262

mixed references, 93

Moala, I., 277

modeless userforms, 475476

Modify method, 343

modules, 15

MSubstitute() function, 297298

multicolumn list boxes, 486487

multidimensional arrays, declaring, 126127

MultiPage control, 169171, 468

N

Name Manager dialog box, 97

named ranges, 55, 107109

names, 97

adding, 98100

checking for the existence of, 106

comments, 100

deleting, 100

formula, 101

global, 9798

hiding, 106

local, 9798, 104

numbers and, 103

reserved, 104105

string, 101103

table, 103104

types of, 101

using arrays in, 104

nesting

If statements, 8486

loops, 7475

New keyword, referencing a Word application, 430431

noncontiguous ranges, 66

NOW function, 292

NumberFormat property, 361362

numbers

naming, 103

retrieving from mixed text, 298299

sorting, 301303

NumFilesInCurDir() function, 290291

NumUniqueValues() function, 296

O

Object Browser, 45, 433434

object-oriented programming, 28

object(s), 28

assigning a macro to an, 13

properties, 31

objects, 49. See also class modules; DAOs (data access objects)

Chart, 318

ChartFormat, 327

color, applying, 329

creating new instances of, 431

custom

creating, 137139

using, 139140

gradients, applying, 330

LineFormat, 331

patterns, applying, 330

properties, 38, 137. See also properties

Range, 54

texture, applying, 329

variables, 7981

watches, 44

Word, 435

Document, 435437

Range, 438441

referencing via early binding, 427430

referencing via late binding, 430

Selection, 437438

ObjectThemeColor property, 329

Office 365, 314

Office add-ins, 549, 550

adding interactivity, 554557, 559560

defining, 558559

Hello World, 550, 551554

JavaScript and, 569570

writing to the content or task pane, 569

OFFSET property, 177

Offset property, referencing ranges with, 5860

OLAP pivot table, filtering by a list of items, 271273

Oliver, N., 257

OneColorGradient method, 330

OnTime method, 406407

Open method, 436

opening

files in a text editor, 550

text files

delimited files, 417419

fixed-width files, 413417

operators

JavaScript, 566567

xlFilterIcon, 179181

option buttons

adding to a userform, 165166

events, 166

Ozgur, S. M., 549

P

PageFields parameter, 221

parameters, 2931

event, 112113

PageFields, 221

parsing, text files, 260261

passing an array, 131132

password box, 275277

passwords

cracking, 514515

macros and, 515

.Patterned method, 330

patterns, applying to objects, 330

picture, filling objects with a, 329

Pieterse, J. K., 491

pivot table(s), 211, 574. See also Data Model

adding model fields to, 246

advanced features, 220

AutoSort option, 226

building, 245246

calculated fields, 249250

calculated items, 250

changing the calculation to show percentages, 223225

counting the number of records, 221

creating in VBA, 212

adding fields to the data area, 214217

configuration, 213214

defining the pivot cache, 213

data visualizations, 252253

defining, 220221

determining the size of, 217220

drilling-down, 270271

evolution over various Excel versions, 211212

filtering data sets, 229

filters

conceptual, 230231

manual, 229230

search, 234236

ShowDetail property and, 250

slicers, 237241

types, 232234

formatting the intersection of values in, 243244

grouping daily dates to months, quarters, or years, 221223

layout, 250251

OLAP, filtering by a list of items, 271273

producing a static summary, 218220

reports, 217

layout, 251

multiple value fields, 220221

replicating for every product, 226229

suppressing subtotals for multiple row fields, 252

TypeScript and, 255256

Values area

adding numeric fields, 246247

eliminating blank cells, 226

Power Pivot, 244. See also pivot table(s)

Power Query. See also M

Advanced Editor, 387388

building a custom function, 390393

loading large text files to the Data Model, 423424

M and, 385

queries

AlbumTracks, 395, 397

ArtistsAlbums, 394395, 396397

duplicating to make a new query, 393395

error handling, 403

fnGetToken, 392

grouping, 397398

placing results on your dashboard, 398401

SearchArtist, 391, 393, 396

refreshing Spotify credentials after they expire, 390

searching Spotify database for an artist, 388390

storing global variables in a Settings record, 402403

Preserve keyword, 131

PresetGradient method, 330

PresetTextured method, 329

PrintOut method, 437

Priority property, 341

procedural programming, 28

VBA and, 29

programming languages. See also M

BASIC, 2, 28

M, 385

object-oriented, 28

procedural, 28

Programming window, VB Editor, 1719

progress indicator, cell, 274275

Project Explorer, 1415

properties, 31, 137

.Calculation, 223

Cells, referencing ranges with, 5758

ChartColor, 320321

Columns, 61

CurrentRegion, selecting ranges with, 63

custom, creating, 148151

Excel8CompatibilityMode, 577578

Formula, 352354

Help topics, 38

MultiSelect, 163164

NumberFormat, 361362

ObjectThemeColor, 329

OFFSET, 177

Offset, referencing ranges with, 5860

Priority, 341

Range(), 47

Resize, 6061

Rows, 61

ShowDetail, 250

TableRange2, 217218

Type, 341

Version, 577

Properties window, VB Editor, 15

protected password box, 275277

Q

QueryClose event, 172

querying, in Break mode

by hovering, 42

using a Watches window, 4243

using the Immediate window, 4142

Quick Access Toolbar, creating a macro button, 1112

Quick Analysis tool, 2425, 573

R

R1C1 addressing, 49, 87, 90, 91

absolute references, 9293

mixed references, 93

referring to entire columns or rows, 93

relative references, 9192

remembering column numbers associated with column letters, 9596

replacing A1 formulas with, 9495

toggling to, 88

Range object, 54, 438441

Range() property, 47

ranges, 53

color scales, adding, 346347

creating from overlapping ranges, 62

data bars

adding, 342346

using two colors, 352354

finding the first nonzero-length cell in, 296297

icon sets, 347348

specifying, 348349

specifying for subset of a range, 351352

VBA constants, 348349

joining, 62

named, 55, 107109

noncontiguous, 66

referencing

in other worksheets, 5556

relative to another range, 5657

shortcuts, 55

using Cells property, 5758

using Columns and Rows properties, 61

using the CurrentRegion property, 63

using the Offset property, 5860

resizing, 6061

specifying for icons, 350

syntax, 54

tables, 67

worksheets and, 54

reading

from an Access database, 451

text files with more than 1,048, 576 rows, 420423

Record Macro dialog box, 910

recording a macro, 89, 17

absolute references, 1920

Autosum and, 2425

preparations, 1617

relative references, 2024

tips, 2526

records, counting, 221

recursive functions, 290

RefEdit control, 470471

references

absolute, 1920, 9293

array, 104

mixed, 93

relative, 2024, 9192

relationships, creating between tables, 245

relative references, 2024, 9192

RELS file, 525526

removing, add-ins, 545

renaming, controls, 159

reports

fixed-width, converting to a data set, 280283

pivot table, 217

layout, 251

multiple value fields, 220221

replicating for every product, 226229

suppressing subtotals for multiple row fields, 252

reserved names, 104105

resetting, table format, 278279

Resize property, 6061

resizing

ranges, 6061

userforms, 479

Restore Down icon, 39

RetrieveNumbers() function, 298299

retrieving data

from arrays, 128129

date and time of last save, 292

file names, 173174

from forms, 160161

from mixed text, 298299

permanent date and time, 292293

user ID, 291292

returning

addresses of duplicate maximum values, 304305

hyperlink address, 305

ReturnMax() function, 304305

RGB color, applying to sparklines, 373374

ribbon, 517, 572

adding a control, 520

adding custom icons, 528529

buttons, using images on, 527

control attributes, 521525

error handling, 529533

macro button, creating, 1011

using Microsoft Office icons, 527528

Rows property, 61

rules

above/below average, 340

top/bottom, 340

running a macro, 10

with a command button, 534535

using a keyboard shortcut, 533534

S

SaveAs2 method, 436

scaling, sparklines, 366369

scheduling macros, 407, 408411

ScrollBar control, 472473

Search box, AutoFilter and, 179

search filter, 234236

security, 6

add-in, 544545

Disable All Macros with Notification setting, 8

trusted locations

adding, 67

enabling macros outside trusted locations, 78

Select Case construct, 8384

in JavaScript, 564565

using on a worksheets, 306

Select method, 38

SelectAll method, 474

selecting, with SpecialCells, 277278

Selection object, 437438

SetElement method, 322327

.SetSourceData method, 313

Shape Fill drop down, 329330

shared Access database, creating, 449450

sharing

LAMBDA functions, 308

UDFs (user-defined functions), 288

sheet events

chart, 119120

workbook-level, 115116

SheetExists() function, 289290

shortcut(s)

accelerator keys, 483484

Ctrl+T, 244

End+down arrow, 4748

for referencing ranges, 55

running a macro with, 533534

Show Values As tab of the Value Field Settings dialog box, 223

ShowDetail property, 250

size of pivot tables, determining, 217220

slicers, 237243, 574

SLUGIFY.PLUS() function, 309310

SmartArt, 575

Smith, C., 267

sorting, 300301

custom, 273274

numeric and alpha characters, 301303

SparklineGroups.Add method, 363365

sparklines, 363

creating, 363365

dashboards

creating, 378

creating individual sparklines in, 379383

formatting, 369

elements, 374377

using RGB colors, 373374

using theme colors, 369372

scaling, 366369

win/loss charts, formatting, 377378

SpecialCells method, 6466, 201, 277278

spin buttons, 168169

Spotify. See also Power Query

creating a developer account, 386387

querying the list of songs on an album, 395

Search API, 388390

searching the database for an artist, 388389

SQL Server, 463464. See also Access

standard modules, 141142. See also class modules

statements

Case, complex expressions in, 84

DIM, 7980

Exit For, 7374

For, 72

If, nesting, 8486

Select Case, 8384

Step Into feature, 3840

Stop Recording icon, 10

streamlining code, 46

strings

JavaScript, 562

naming, 101103

searching for within text, 303304

styles, chart, 315318

substituting, multiple characters, 297298

subtotals, suppressing for multiple row fields, 252

Sullivan, J., 271

SUM function, 25

SumColor() function, 295

T

tab stops, setting on userforms, 484485

tab strips, 468470

tables. See also Access

Access

adding fields on the fly, 462463

adding on the fly, 461462

checking for the existence of, 460

checking for the existence of a field, 461

adding to the Data Model, 244245

creating a relationship between, 245

naming, 103104

referencing, 67

resetting the format, 278279

tblTransfer, 449

testing, macros, 19, 2223

text boxes, 160, 161162

text files

importing, 413

with more than 1,048, 576 rows, 419420

reading, 420423

using Power Query to load, 423424

opening

delimited files, 417419

fixed-width files, 413417

reading into memory and parsing, 260261

writing, 424425

Text Import Wizard, 3537

texture, applying to objects, 329

theme colors, applying to sparklines, 369372. See also color(s)

time. See also dates

24-hour, 117118

of last save, retrieving, 292

retrieving, 292293

Timelines, 241243

tip text, adding to userforms, 484

TOC2HTML() function, 310311

ToggleButton control, 471472

toolbars, UserForm, 465466

ToolTips, 42

top/bottom rules, 340, 355356. See also conditional formatting

tracking, user changes, 267268

transparent forms, setting up, 487488

trapping

application events, 134135

embedded chart events, 136137

trendline, formatting, 331

trusted locations, 67

Tufte, E., 363

TwoColorGradient method, 330

Type property, 341

TypeScript, 576

comparing to VBA, 253255

creating a pivot table, 255256

TypeText method, 437438

U

UDFs (user-defined functions), 285

BookOpen(), 288290

building, 286287

ColName(), 305306

ContainsText(), 303304

ConvertWeekDay(), 299300

creating, 285

DateTime(), 292293

FirstNonZeroLength(), 296297

GetAddress(), 305

IsEmailValid(), 293295

JavaScript, 549

LastSaved(), 292

MSubstitute(), 297298

NumFilesInCurDir(), 290291

NumUniqueValues(), 296

RetrieveNumbers(), 298299

ReturnMax(), 304305

sharing, 288

SortConcat(), 300301

SumColor(), 295

WinUserName(), 291292

UDTs (user-defined types)

creating custom properties, 148151

declaring, 149

Union method, joining multiple ranges, 62

UnselectAll method, 474

Until clause, 7779

updates, scheduling, 407

Urtis, T., 265, 270, 274

user ID, retrieving, 291292

UserForm toolbar, 465466

userforms, 153. See also controls; forms

accelerator keys, 483484

adding option buttons, 165166

calling, 156

check boxes, 466468

coloring the active field, 485486

controls

adding at runtime, 477478

adding on the fly, 479

collections and, 473475

ProgIds, 480

creating, 155156

disabling the X for closing, 498

events, 157158

graphics, 167

hiding, 156157

hyperlinks, 476477

illegal window closing, 172

images, adding on the fly, 480481

input boxes, 153154

message boxes, 154155

modeless, 475476

picture catalog, 481483

programming, 157

RefEdit control, 470471

resizing on the fly, 479

scrollbars, 472473

setting tab stops, 484485

sizing on the fly, 479

tab strips, 468470

tip text, adding, 484

transparent, 487488

verifying field entry, 171

UserPicture method, 329

utilities

combining workbooks, 262263

converting a fixed-width report to a data set, 280283

copying data to separate worksheets without using Filter, 263264

creating a cell progress indicator, 274275

creating a custom sort order, 273274

creating an Excel state class module, 268270

drilling-down a pivot table, 270271

exporting data to an XML file, 264265

filtering an OLAP pivot table by a list of items, 271273

importing and deleting a CSV file, 260

listing files in a directory, 257260

placing a chart in a cell note, 265267

reading a text file into memory and parsing, 260261

resetting a table’s format, 278279

selecting with SpecialCells, 277278

separating worksheets into workbooks, 261262

tracking user changes, 267268

using a protected password box, 275277

using VBA Extensibility to add code to new workbooks, 279280

V

validating, email addresses, 293295

values

duplicate, minimizing, 340

unique, counting, 296

variables, 49

declaring, 14

global, 402

JavaScript, 561

object, 7981

For statement, 72

Variant, 128

Variant variables, 128

VB Editor, 1314. See also Object Browser

Break mode, 3843. See also breakpoints

converting a file to an add-in, 542543

Help and, 3334

Immediate window, 35, 4142

Programming window, 1719

Project Explorer, 1415

Properties window, 15

settings, 14

VBA, 3132

barriers to learning

macro recorder, 2

syntax, 2

charts

applying a color, 320321

borders, 331

combo, 331334

filtering, 322

formatting, 327328

line settings, 331

map, 335

referring to, 318319

SetElement method, 322327

specifying a title, 319320

styles, 315318

trendline, 331

waterfall, 336337

collections, 29

comparing to TypeScript, 253255

constants, icon set, 348349

data bars, 339, 352354

adding to a range, 342346

color, applying, 344345

using two colors in a range, 352354

data visualizations, 340341

error handling, 501503

Extensibility, 279280

formula-based conditions, 196200

icon sets, 347348

creating for a subset of a range, 351352

specifying ranges for each icon, 350

learning, 3

methods, 28, 2931

objects, 28, 31

Office 365 and, 314

pivot tables

adding fields to the data area, 214217

adding model fields to, 246

adding numeric fields to the Values area, 246247

advanced features, 220

AutoSort option, 226

calculated fields, 249250

calculated items, 250

changing the calculation to show percentages, 223225

conceptual filter, 230231

configuration, 213214

creating, 212

creating a Data model, 247249

data visualizations, 252253

defining, 220221

defining the pivot cache, 213, 245246

determining the size of, 217220

eliminating blank cells in the Values area, 226

filter types, 232234

filtering, 229

formatting the intersection of values in, 243244

grouping daily dates to months, quarters, or years, 221223

layout, 250251

manual filter, 229230

replicating the report for every product, 226229

reports, 251

search filter, 234236

ShowDetail property, 250

slicers, 237241

Timelines, 241243

procedural programming and, 29

simplifying Power Query queries, 396

AlbumTracks, 397

ArtistsAlbums, 396397

SearchArtist, 396

syntax, 38

verifying, field entry, 171

Version property, 577

Visual Basic, BASIC and, 2

VLOOKUP function, 107

W

watches, 4243

on objects, 44

setting a break point, 43

waterfall charts, creating, 336337

Wei, J., 273

While clause, 7779

While.Wend loops, 79

Windows API, 491. See also API (Application Programming Interface)

win/loss charts, formatting, 377378

WinUserName() function, 291292

With…End With block, 50

Word

bookmarks, 441442

constants, retrieving the real value of, 433434

using the Object Browser, 433434

using the Watches window, 433

controlling form fields in, 443444

documents

closing, 436437

creating, 435436

opening, 436

printing, 437

saving changes to, 436

templates, 436

objects, 435

Document, 435437

Range, 438441

Selection, 437438

referencing an existing instance of, 431432

referencing objects via early binding, 427430

referencing objects via late binding, 430

workbooks, 2

adding code to, 279280

checking for existing sheets in, 289290

code, 546547

combining, 262263

converting to an add-in, 540541

events, 113115

open, checking for, 288289

ribbon, 517518

sheet events, 115116

themes, 369

worksheets

copying data to without using Filter, 263264

events, 116117

ranges and, 54, 5556

Select Case construct, 306

separating into workbooks, 261262

writing, text files, 424425

X-Y-Z

xlFilterCopy, 202

combining multiple techniques, 205209

copying a subset of columns and reordering, 203205

copying all columns, 202203

xlFilterIcon operator, 179181

XLOOKUP function, named ranges, 107109

.xlsm file type, 5, 525

XML

adding a control to a ribbon, 520

creating a tab and a group, 519

customui folder, 518519

defining an Office add-in, 558559

exporting data to a file, 264265

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.52.46