Index

Symbols

:= (colon-equal sign), 30

{ } (curly braces), in JavaScript, 536

-- (decrement operator), in JavaScript, 543

++ (increment operator), in JavaScript, 543

+ (plus sign), in JavaScript, 537

“” (quotation marks) in JavaScript, 537

; (semicolons), in JavaScript, 536

[ ] (square brackets), as Evaluate method, 103

3D Models, 551

24-hour clocks, formatting cells as, 115-116

32-bit API declarations, compatibility, 471-472

64-bit API declarations, compatibility, 471-472

9 runtime error (subscript out of range), 488-489

1004 runtime error

method range of object global failed, 489-490

troubleshooting, 199-200

VB Editor actions, 479-480

A

A1 references

copying formulas, 89-91

R1C1 references versus, 87-88

replacing multiple with single R1C1 reference, 93-95

toggling, 88-89

About dialog box, customizing, 475

above average conditional formatting, 344

above/below average rules, 330

absolute references

in recorded macros, 19-20

with R1C1 references, 92

accelerator keys in userforms, 461-462

Access

database connection terminology, 428-429

fields

checking for existence, 438-439

creating, 440

MDB files, 425

creating shared databases, 427-428

pass-through queries, 429

records

adding, 430-431

deleting, 435

retrieving, 431-433

summarizing, 436-437

updating, 433-435

tables

checking for existence, 437-438

creating, 439

accessing file structure, 501

ACE engine, 426

Activate event (userforms), 155

active control, coloring, 463-464

ActiveCell property, 45

ActiveX controls, running macros from, 512-513

ActiveX Data Objects (ADOs), 426-429

ActiveX labels, minimizing duplicate code, 144-146

Add method

array names, 104

Document object, 415

formula names, 101

number names, 103

string names, 101-103

tables, 103-104

Add Watch dialog box, 43

add-ins. see also Office add-ins

advantages of, 515

closing, 521

converting workbooks to, 516-517

with Save As, 517

with VB Editor, 518

hidden workbooks versus, 521-523

installing, 519-520

removing, 521

saving data in, 516

security, 520

types of, 515

viewing, 519

AddAboveAverage method (FormatConditions object), 344

AddChart method, 328

AddChart2 method, 306-307

AddControl event

frames, 163

MultiPage controls, 168

userforms, 155

AddFields method (pivot tables), 218

adding

button images (on ribbon), 503-505

buttons in HTML, 533-534

color scales to ranges, 336-337

comments to names, 100

controls

to ribbon, 496-500

at runtime, 455-461

to userforms, 157

data bars to ranges, 331-335

Data Model fields to pivot tables, 243

fields in pivot table data area, 212-215

icon sets to ranges, 337-340

images to userforms, 458-459

interactivity to Office add-ins, 530-532, 535

names, 98-99

records (database), 430-431

tables to Data Model, 242

trusted locations, 6-7

value fields to Data Model pivot tables, 243-244

VBA code to workbooks with VBA Extensibility, 276-277

addresses (cell)

of duplicate max values, returning, 301-302

column letter of, returning, 302-303

addresses

email, validating, 287-289

hyperlink, returning, 302

AddTop10 method (FormatConditions object), 345

AddUniqueValues method (FormatConditions object), 346

ADOs (ActiveX Data Objects), 426-429

Advanced Filter, 181

criteria ranges, 189-190

clearing, 198

formula-based conditions, 191-198

joining with logical AND, 191

joining with logical OR, 190-191

in Excel interface, 182

extracting unique list of values, 182

with Excel interface, 183-184

for multiple fields, 187-188

with VBA code, 184-187

filter in place, 199

no records returned, 199-200

viewing all records after, 200

returning all matching records, 200

copying all columns, 200-201

copying subset of columns, 201-203

creating individual reports, 203-207

AfterUpdate event

list boxes/combo boxes, 162

option buttons, 163-164

spin buttons, 166

text box control, 159

alerts, suppressing, 486

alphanumeric data, sorting, 298-300

AND, joining criteria ranges with, 191

API (application programming interface) declarations, 469

32-bit and 64-bit compatibility, 471-472

calling, 470-471

checking open network files, 473

creating running timer, 476-477

customizing About dialog box, 475

disabling X button in userforms, 475-476

explained, 469-470

playing sounds, 477

returning computer name, 472-473

returning display resolution, 474

application events

in class modules, 118, 132-133

list of, 119, 122

Application object, 38, 45

application states, enabling/disabling, 263, 265

Application.EnableEvents = False events, preventing recursive procedure calling, 116

applying math functions to arrays, 544

Areas collection (Range object), selecting noncontiguous ranges, 66

arguments

for ribbon controls, 499-500

troubleshooting, 508-509

arranging VBA and Excel windows, 39

array formulas, R1C1 references with, 96

arrays, 123

applying math functions to, 544

data, retrieving, 126-127

declaring, 123-124

dynamic arrays, declaring, 128-129

filling, 125-126

formulas, 549

functions, passing to, 130

in JavaScript, 538

multidimensional, declaring, 124-125

names, creating, 104

optimizing code with, 128

values, passing to/from, 130

assigning

macros to form controls, 12-13

shortcut keys to macros, 9

assignment operators in JavaScript, 542-543

associating column names with numbers in R1C1 references, 95

attributes

for ribbon controls, 497-498

troubleshooting, 506

author contact information, 554

AutoFilter

avoiding when copying data, 257-258

dynamic filters, 178-179

filtering

by color, 177

by icon, 178

replacing loops with, 173-176

on selected columns only, 207-208

selecting

multiple items, 176-177

with Search box, 177

visible cells only, 179-180

AutoShow, filtering pivot tables, 232-234

AutoSort in pivot tables, 224

AutoSum in recorded macros, 23-26

B

backward compatibility, creating charts, 328

backward in code, moving, 40

BASIC, Visual Basic versus, 2

BeforeDragOver event

frames/option buttons, 163

graphics, 165

label/text box/command button control, 159

list boxes/combo boxes, 162

MultiPage controls, 168

spin buttons, 166

userforms, 155

BeforeDropOrPaste event

frames/option buttons, 163

graphics, 165

label/text box/command button control, 159

list boxes/combo boxes, 162

MultiPage controls, 168

spin buttons, 166

userforms, 155

BeforeUpdate event

list boxes/combo boxes, 162

option buttons, 164

spin buttons, 166

text box control, 159

below average conditional formatting, 344

blank cells

highlighting, 348-349

in pivot table value areas, eliminating, 223-224

bookmarks (Word), 421-422

breaking out of loops, 539

breakpoints, 40

in Watches window, 43

Browse dialog box, 6

building multiplication tables, 93-95

buttons

adding in HTML, 533-534

command buttons, running macros, 510-511

on ribbon, adding images to, 503-505

C

calculated fields in pivot tables, 246-247

calculated items in pivot tables, 247

calculations in pivot tables, changing to percentages, 221-223

calling

API declarations, 470-471

userforms, 154

canceling scheduled macros, 382-383

Cascading Style Sheets (CSS), 534

Case Else statements in Select Case...End Select constructs, 83

case of text, changing, 273-274

case sensitivity

of JavaScript, 526, 536

in text editors, 526

of XML, 526

Case statements in Select Case...End Select constructs, 83-84

CBool function, 284

cell ranges.See ranges

cell references.See references

cells

comments

charts in, 260-262

resizing, 259-260

finding first nonzero-length in range, 292-293

formatting as military time, 115-116

highlighting

above/below average, 344

blank/error cells, 348-349

by date, 348

first unique value, 349-350

formula-based, 349-350

by text, 348

top/bottom values, 345

unique/duplicate, 346-347

by value, 347

progress indicators, creating, 269-270

in ranges

finding empty cells, 62-63

selecting specific cells with SpecialCells method, 63-65

returning

addresses of duplicate max values, 301-302

column letter of address, 302-303

hyperlink addresses, 302

reversing contents, 300-301

selecting with SpecialCells, 274-275

summing based on color, 289-290

visible selecting, 179-180

Cells object, as array, 124

Cells property (Range object), selecting ranges, 57-58

Change event

formatting cells as military time, 115

list boxes/combo boxes, 162

MultiPage controls, 168

option buttons, 164

spin buttons, 166

text box control, 159

tracking user changes, 262-263

changing

colors in waterfall charts, 327-328

default file type, 5

names.See renaming

part of pivot table, 215

pivot table calculations to percentages, 221-223

pivot table layout, 248

rows/formulas to variables in recorded code, 49

shortcut keys for macros, 18

text case, 273-274

characters, substituting multiple, 293-294

chart colors, applying, 312-313

chart events, 116

for embedded charts, 116-117, 134-135

list of, 117-118

chart styles, list of, 307-310

chart titles, specifying, 311-312

ChartColor property, 312-313

ChartFormat object, 319-320

charts

combo charts, creating, 323-325

in comments, 260-262

creating, 305

with AddChart2 method, 306-307

backward compatibility, 328

chart styles, 307-310

exporting as graphics, 328

filtering, 313

formatting

chart colors, 312-313

chart titles, 311-312

fill color, 320-322

with Format method, 319-320

line settings, 322

referring to specific chart, 310-311

with SetElement method, 314-319

map charts, creating, 326

new features, 549-550

new types, 305

Power BI Custom Visuals, 306

version compatibility, 549

waterfall charts, creating, 326-328

check box controls (Word), 422-424

check boxes, 444-446

class modules, 131

application events in, 118, 132-133

collections, creating, 140-142

custom objects

creating, 135-137

referencing, 137-138

embedded chart events in, 116-117, 134-135

enabling/disabling application states, 263, 265

inserting, 131-132

minimizing duplicate ActiveX label code, 144-146

cleaning up recorded code, tips for, 46, 50-52

copy/paste statements, 49

deleting selections, 46-47

finding last data row, 47-48

R1C1 formulas, 49

range references, 47

variables for rows/formulas, 49

With...End With statements, 50

ClearAllFilters method (pivot tables), 229

clearing

Advanced Filter criteria ranges, 198

conceptual filters (pivot tables), 229

Click event

frames/option buttons, 164

graphics, 165

list boxes/combo boxes, 162

MultiPage controls, 168

userforms, 155

clients, training in error handling, 487

clip art, assigning macros to, 12

Close method (Document object), 416

closing

add-ins, 521

documents (Word), 416

Excel, canceling scheduled macros, 383

Properties window, 513

userforms

disabling X button, 475-476

illegally, 169-170

code optimization with arrays, 128

collections, 131, 138

creating, 138

in class modules, 140-142

in standard modules, 139-140

dictionaries, compared, 142-144

grouping controls into, 451-453

minimizing ActiveX label code, 144-146

objects versus, 29

colon-equal sign (:=), 30

color scales, 329

adding to ranges, 336-337

coloring active control, 463-464

colors

changing in waterfall charts, 327-328

chart colors, applying, 312-313

for data bars, 333

fill color, formatting charts, 320-322

filtering by with AutoFilter, 177

multiple colors for data bars, 341-343

RGB colors, 362, 364

summing cells based on, 289-290

theme colors, 359-362

column sets, importing text files into, 402-403

column sparklines, 353

ColumnGrand property (pivot tables), 248

columns

associating names with numbers in R1C1 references, 95

copying all with Advanced Filter, 200-201

copying subset with Advanced Filter, 201-203

referencing with R1C1 references, 93

reordering with Advanced Filter, 201-203

returning letter of address, 302-303

selected columns, AutoFilter on, 207-208

sorting and concatenating, 296-298

Columns property (Range object), referencing ranges, 61

combining

userforms, 167-169

workbooks, 256-257

combo boxes

events, 162

list boxes versus, 160-161

combo charts, creating, 323-325

command button controls, 157-159

events, 159

running macros, 510-511

comments, 18

adding to names, 100

charts in, 260-262

in HTML, 533

in JavaScript, 531, 536

resizing, 259-260

Compatibility mode, troubleshooting, 552

complex expressions in Case statements, 84

computer name, returning, 472-473

concatenating

columns, 296-298

in JavaScript, 537

conceptual filters for pivot tables, 228-231

conditional compilation, 472

conditional formatting. see also data visualizations

above/below average cells, 344

blank/error cells, 348-349

custom number formats, 350-351

date-based, 348

with formulas, 349-350

progress indicators, creating, 269-270

text-based, 348

top/bottom values, 345

unique/duplicate cells, 346-347

value-based, 347

conditions

formula-based in Advanced Filter, 191-198

in If...Then...Else constructs, 81-82

in Select Case...End Select constructs, 83-84

configuring pivot tables, 211-212

connections, 428-429

constant values

compatibility, 552

retrieving when referencing Word, 412-414

constants

defined, 35-37

for SetElement method, 314-318

content management system, Excel as, 388-390

content panes (Office add-ins), 534, 544

content problem error message, 507-508

controls

active control, coloring, 463-464

adding

to ribbon, 496-500

at runtime, 455-461

check boxes, 444-446

combo boxes, 160-162

command buttons, 157-159

frames, 163-164

graphics, 164-165

grouping into collections, 451-453

labels, 157-159

list boxes, 160-162

multicolumn list boxes, 464-465

MultiPage, 167-169, 446

option buttons, 163-164

organizing on UserForm toolbar, 443-444

ProgIDs for, 458

programming, 156

RefEdit, 448-449

renaming, 156

scrollbars as sliders, 450-451

spin buttons, 165-167

tab order, setting, 462-463

TabStrip, 446-448

text boxes, 157-159

toggle buttons, 449-450

troubleshooting new controls, 157

in Word, 422-424

converting

formulas to R1C1 style, 96

pivot tables to values, 215-217

week numbers to dates, 295-296

workbooks to add-ins, 516-517

with Save As, 517

with VB Editor, 518

copying

all columns with Advanced Filter, 200-201

data to worksheets, 257-258

formulas, 89-91

in recorded code, 49

subset of columns with Advanced Filter, 201-203

counting

records in pivot tables, 219

unique values, 290-291

workbooks in directory, 284-285

cracking passwords, 490-491

Create New Theme Colors dialog box, 359

CreateObject function, referencing Word, 411

CreatePivotTable method, 211-212

creating

array names, 104

arrays, 123-124

charts, 305

with AddChart2 method, 306-307

backward compatibility, 328

chart styles, 307-310

combo charts, 323-325

custom sort order, 268-269

customui folder/file, 494-495

custom web pages, 387

dashboards, 368-373

documents (Word), 415-416

dynamic arrays, 128-129

fields (database), 440

formula names, 101

icon sets for subset of range, 340-341

individual reports with Advanced Filter, 203-207

macro buttons

on Quick Access Toolbar, 11

on ribbon, 10

map charts, 326

multidimensional arrays, 124-125

named ranges, 98-99

number names, 103

Office add-ins, 526-530

pivot tables, 211-212

progress indicators, 269-270

ranges from overlapping ranges, 62

ribbon tabs/groups, 495-496

running timers, 476-477

shared Access databases, 427-428

sparklines, 353-355

for dashboard, 369-373

string names, 101-103

table relationships in Data Model, 242

tables, 103-104

tables (database), 439

transparent userforms, 465-466

UDFs (user-defined functions), 279-281

userforms, 153-154

waterfall charts, 326-328

criteria ranges in Advanced Filter, 189-190

clearing, 198

formula-based conditions, 191-198

joining

with logical AND, 191

with logical OR, 190-191

Criteria reserved name, 105

CSS (Cascading Style Sheets), 534

CSV (comma-separated values) files, importing and deleting, 254

.csv file extension, opening files with, 397

curly braces ({ }), in JavaScript, 536

CurrentRegion property (Range object), 175

selecting ranges, 63

cursor locations, 428

cursor types, 428

cursors, 428

custom functions in JavaScript, 525. see also UDFs (user-defined functions)

custom icons, adding to buttons (on ribbon), 504-505

custom number formats, 350-351

custom objects, 131. see also class modules

creating, 135-137

referencing, 137-138

custom properties, creating, 146-149

custom sort order, creating, 268-269

Custom UI Editor tool, 502

custom web pages, creating, 387

customizing

About dialog box, 475

ribbon, 493

accessing file structure, 501

adding button images, 503-505

adding controls, 496-500

creating customui folder/file, 494-495

creating tabs/groups, 495-496

RELS file, 501-502

renaming/opening workbooks, 502

troubleshooting error messages, 493, 505-509

visibility of ribbon, 494

customui folder/file, creating, 494-495

D

daily dates, grouping in pivot tables, 219-221

DAOs (data access objects), 426

dashboards, creating, 368-373

data

in arrays, retrieving, 126-127

web data

retrieving, 375-381

scheduling retrieval, 381

data access objects (DAOs), 426

data area for pivot tables, adding fields, 212-215

data bars, 329

adding to ranges, 331-335

multiple colors for, 341-343

Data field (pivot tables), 218-219

Data Model, 241

importing text files into, 403-404

pivot cache, defining, 243

pivot tables

adding text fields, 243

adding value fields, 243-244

example code, 244-246

tables

adding, 242

creating relationships, 242

data sets for pivot tables, replicating reports, 224-227

data types for input boxes, 152

data visualizations, 329. see also conditional formatting

color scales, adding to ranges, 336-337

data bars

adding to ranges, 331-335

multiple colors for, 341-343

icon sets

adding to ranges, 337-340

creating for subset of range, 340-341

mixing, 343-344

in pivot tables, 249-250

types of, 329-330

VBA methods/properties for, 330-331

Database reserved name, 105

databases, SQL Server, 440-442. see also Access; MDB files

dates

converting week numbers to, 295-296

daily dates, grouping in pivot tables, 219-221

highlighting cells based on, 348

retrieving

permanent, 287

saved, 286

DblClick event

frames/option buttons, 164

graphics, 165

label/text box/command button control, 159

list boxes/combo boxes, 162

MultiPage controls, 168

userforms, 155

Deactivate event (userforms), 155

Debug mode, errors not showing up, 487-488

debugging tools. see also error handling

breakpoints, 40

Immediate window, 41-42

moving forward/backward in code, 40

running code while stepping, 41

stepping through code, 38-40

ToolTips, 42

Watches window, 43-45

declarations (API)

32-bit and 64-bit compatibility, 471-472

calling, 470-471

checking open network files, 473

creating running timer, 476-477

customizing About dialog box, 475

disabling X button in userforms, 475-476

explained, 469-470

playing sounds, 477

returning computer name, 472-473

returning display resolution, 474

declaring

arrays, 123-124

dynamic arrays, 128-129

multidimensional arrays, 124-125

variables, 14, 79

decrement operator (--), in JavaScript, 543

default file type, changing, 5

defined constants in Help topics, 35-37

defining

pivot cache, 210-211

in Data Model, 243

ranges (Word), 418-419

slicer cache, 235

deleting

add-ins, 521

CSV files, 254

duplicate values, 291-292

names, 100

part of pivot table, 215

pivot cache, 216

records (database), 435

selections in recorded code, 46-47

delimited strings, extracting elements from, 296

delimited text files, 393

opening, 397-399

delimiter settings, 401

Design tab (pivot tables), Layout group, 248

Developer tab, enabling, 3-4

dictionaries, collections versus, 142-144

Dim statements, declaring variables, 79

directories

counting workbooks in, 284-285

listing files in, 251-253

disabling

application states, 263, 265

events, 111

macros, 7-8

displaying File Open dialog box, 170-171

display resolution, returning, 474

DLLs (dynamic link libraries), 469

Document object (Word), 415

closing documents, 416

creating documents, 415-416

opening documents, 416

printing documents, 417

documents (Word)

bookmarks, 421-422

closing, 416

creating, 415-416

form fields, 422-424

opening, 416

printing, 417

selections in, 417

inserting text, 417-418

navigating, 417

ranges, 418-421

DoEvents syntax, 488

Do...Loop loops, 75-77

exiting, 76-77

Until clause in, 77-78

While clause in, 77-78

drilling down pivot tables, 265-266

drop-down menus (AutoFilter), hiding, 207-208

DropButtonClick event

combo boxes, 162

text box control, 159

duplicate ActiveX label code, minimizing, 144-146

duplicate cells, highlighting, 346-347

duplicate max values, returning addresses of, 301-302

duplicate values, removing, 291-292

duplicate values rules, 330

dynamic arrays, declaring, 128-129

dynamic cursors, 428

dynamic filters in AutoFilter, 178-179

dynamic link libraries (DLLs), 469

E

early binding, 407-409

Edit Watch dialog box, 43

editing macros

Project Explorer, 14-15

Properties window, 15

VB Editor interface, 13-14

VB Editor settings, 14

either/or decisions in If...Then...Else constructs, 82

Else statements, 81-82

ElseIf statements, 82

email addresses, validating, 287-289

embedded charts, events for, 116-118, 134-135

empty cells in ranges, finding, 62-63

empty files, checking for, 489-490

enabling

application states, 263, 265

Developer tab, 3-4

events, 111

macros, 7-8

End If statements, 81

EndKey method (Selection object), 417

Enter event

frames/option buttons, 164

list boxes/combo boxes, 162

MultiPage controls, 169

spin buttons, 166

text box/command button control, 159

Err object, 484

Error event

frames/option buttons, 164

graphics, 165

label/text box/command button control, 159

list boxes/combo boxes, 162

MultiPage controls, 169

spin buttons, 166

userforms, 155

error handling. see also troubleshooting

checking for empty files, 489-490

with Err object, 484

errors not in Debug mode, 487-488

by Excel version, 492

ignoring errors, 484-486

method range of object global failed (error 1004), 489-490

multiple error handlers, 484

with On Error Go To, 482-483

pausing macro, 487-488

purposely encountering errors, 486-487

subscript out of range (error 9), 488-489

suppressing alerts, 486

training clients in, 487

userforms, 481-482

VB Editor actions, 479-482

error messages, troubleshooting on ribbon, 493, 505-509

errors. see also runtime errors

with filter in place, 199-200

highlighting cells with, 348-349

Evaluate method, avoiding, 103

events. see also procedures

application events

in class modules, 118, 132-133

list of, 119, 122

chart events, 116

for embedded charts, 116-117, 134-135

list of, 117-118

for check boxes, 445-446

for combo boxes, 162

for command button controls, 159

enabling/disabling, 111

for frames, 163-164

for graphic controls, 165

for label controls, 159

levels of, 109

for list boxes, 162

in MultiPage controls, 168-169

for option buttons, 163-164

parameters, 110

for RefEdit controls, 448-449

for scrollbars, 451

for spin buttons, 166-167

for TabStrip controls, 447-448

for text box controls, 159

for toggle buttons, 449-450

in userforms, 155-156

viewing and inserting, 110

where to use, 109

workbook events, list of, 111-113

workbook-level sheet events, list of, 113-114

worksheet events, list of, 114-115

examining recorded macro code, 33-34

breakpoints, 40

defined constants, 35-37

in Immediate window, 41-42

moving forward/backward in code, 40

optional parameters, 34

properties returning objects, 38

running code while stepping, 41

stepping through code, 38-40

with ToolTips, 42

in Watches window, 43-45

Excel

checking if open on network, 473

as content management system, 388-390

interface

Advanced Filter in, 182

extracting unique list of values, 183-184

formula-based conditions, 193-194

pivot tables, history in, 209-210

referencing Word from, 407

CreateObject function, 411

early binding, 407-409

GetObject function, 411-412

late binding, 410

New keyword, 410

retrieving constant values, 412-414

Excel 97-2003 Workbook (.xls) file type, 5

Excel 2019

file types, 4-5

changing default, 5

help features, object model, 551

new features, 547

3D Models, 551

array formulas, 549

charts, 549-550

icons, 550

pivot tables, 550

Quick Analysis tool, 549

ribbon, 548

single-document interface (SDI), 548-549

slicers, 550

SmartArt, 551

Office 365 subscription versus, 547

Excel Binary Workbook (.xlsb) file type, 5

Excel Macro-Enabled Workbook (.xlsm) file type, 4-5

Excel versions

backward compatibility when creating charts, 328

error handling in, 492

password schemes in, 491-492

verifying

with Excel8CompatibilityMode property, 553

with Version property, 552

Excel Workbook (.xlsx) file type, 4

Excel8CompatibilityMode property, 553

existence of names, checking for, 106

Exit Do statement, 76

Exit event

frames/option buttons, 164

list boxes/combo boxes, 162

MultiPage controls, 169

spin buttons, 166

text box/command button control, 159

Exit For statements, 73-74

exiting

Do...Loop loops, 76-77

For...Next loops early, 73-74

exporting

charts as graphics, 328

tables to XML, 258-259

Extract reserved name, 105

extracting

elements from delimited strings, 296

unique list of values, 182

with Excel interface, 183-184

for multiple fields, 187-188

with VBA code, 184-187

F

F1 shortcut key (Help topics), 32-33

FieldInfo parameter, values in, 396-397

fields

calculated fields in pivot tables, 246-247

Data Model fields, adding to pivot tables, 243

database fields

checking for existence, 438-439

creating, 440

multiple value fields

extracting unique list of values, 187-188

in pivot tables, 218-219

in pivot table data area, adding, 212-215

requiring in userforms, 169

row fields in pivot tables, suppressing subtotals, 249

skipping during imports, 395

value fields, adding to Data Model pivot tables, 243-244

file formats, troubleshooting, 509

file names, setting in cells, 282

File Open dialog box, displaying, 170-171

file path, setting in cell, 282

file structure, accessing, 501

file types in Excel 2019, 4-5

files

CSV files, importing and deleting, 254

empty files, checking for, 489-490

listing in directory, 251-253

opening in Notepad, 526

saving, changing default file type, 5

selecting in userforms, 170-171

text files, reading/parsing in memory, 254-255

fill color, formatting charts, 320-322

filling arrays, 125-126

Filter. See AutoFilter

filter in place in Advanced Filter, 199

no records returned, 199-200

viewing all records after, 200

filtering. see also Advanced Filter

charts, 313

OLAP pivot tables, 266-268

pivot tables

with AutoShow, 232-234

with conceptual filters, 228-231

manually, 227-228

with Search box, 232

with slicers, 234-238

with Timeline slicers, 238-241

record sets in pivot tables, 247

finding

empty cells in ranges, 62-63

first nonzero-length cell in range, 292-293

last data row in recorded code, 47-48

pivot table size, 215-217

results in web data, 378-379

fixed-width text files, opening, 393-397

flow control. see also loops

If...Then...Else constructs, 81-82

conditions in, 81-82

either/or decisions in, 82

ElseIf statements in, 82

End If statements in, 81

nesting If statements, 84-86

Select Case...End Select constructs, 83-84

for (... in ...) statement in JavaScript, 541-542

For Each...Loop loops, 79-80

For each..next statements in JavaScript, 541-542

for loops in JavaScript, 539

For statements in For...Next loops, 69-71

Step clause in, 72-73

variables in, 71-72

For...Next loops, 69-71

exiting early, 73-74

nesting, 74

Step clause in For statement, 72-73

variables in For statement, 71-72

form controls, assigning macros to, 12-13

form fields (Word), 422-424

Format method (formatting charts), 319-320

FormatConditions collection, 330

formatting

cells as military time, 115-116

charts

chart colors, 312-313

chart titles, 311-312

fill color, 320-322

with Format method, 319-320

line settings, 322

referring to specific chart, 310-311

with SetElement method, 314-319

conditional formatting. see also data visualizations

above/below average, 344

blank/error cells, 348-349

custom number formats, 350-351

date-based, 348

with formulas, 349-350

text-based, 348

top/bottom values, 345

unique/duplicate cells, 346-347

value-based, 347

ranges (Word), 419-421

rows with AutoFilter, 173-176

slicers, 238

sparklines, 359

with RGB colors, 362-364

sparkline elements, 364-366

with theme colors, 359-362

win/loss charts, 366-367

tables, resetting formatting, 275

forms in hidden workbooks, 522-523. see also userforms

formula-based conditions in Advanced Filter criteria ranges, 191-198

formulas

array formulas, R1C1 references with, 96

for arrays, 549

changing to variables in recorded code, 49

conditional formatting with, 349-350

converting to R1C1 style, 96

copying, 89-91

names, creating, 101

R1C1, in recorded code, 49

in text fields, troubleshooting, 396

forward in code, moving, 40

found a problem error message, 507-508

frame controls, 163-164

FreeFile function, 401

FTP, publishing web data via, 390-391

Function Arguments dialog box, 281

functions. see also declarations (API); UDFs (user-defined functions)

arrays, passing to, 130

in JavaScript, 535

math functions in JavaScript, 543-544

names, checking for existence, 106

recursive, 284

G

GetObject function, referencing Word, 411-412

GetUserName API function, 470-471

globally unique identifiers (GUIDs), 528

global names, 97-98

Go To dialog box, 21-22

Go To Special dialog box, 63-65

hiding rows, 180-181

selecting visible cells only, 179-180

gradients, formatting charts, 321-322

graphic controls, 164-165

graphics, exporting charts as, 328

grouping

controls into collections, 451-453

daily dates in pivot tables, 219-221

GroupName property (option buttons), 163

groups (on ribbon), creating, 495-496

GUIDs (globally unique identifiers), 528

H

Hello World example (Office add-ins), 526-530

help features

in Excel 2019

Help topics, 32-37

macro recorder as, 32

Object Browser, 45-46

object model, 551

in userforms

accelerator keys, 461-462

coloring active control, 463-464

tab order, 462-463

tip text, 462

Help topics, 32-33

defined constants, 35-37

OpenText method, 33

optional parameters, 34

properties returning objects, 38

hiding

drop-down menus (AutoFilter), 207-208

names, 105

rows with Go To Special dialog box, 180-181

userforms, 154

workbooks, 521-523

highlight cells rules, 330

highlighting

cells

above/below average, 344

blank/error cells, 348-349

by date, 348

first unique value, 349-350

formula-based, 349-350

by text, 348

top/bottom values, 345

unique/duplicate, 346-347

by value, 347

rows, 350

HomeKey method (Selection object), 417

horizontal axis in sparklines, viewing, 364-365

hovering, querying variables by, 42

HTML

creating custom web pages, 387

in Office add-ins, 532

buttons, 533-534

CSS files, 534

tags, 533

saving workbooks as, 386-387

hyperlinks

returning addresses of, 302

running macros from, 513-514

in userforms, 454-455

I

icon sets, 329

adding to ranges, 337-340

creating for subset of range, 340-341

mixing, 343-344

icons

custom icons, adding to buttons (on ribbon), 504-505

filtering with AutoFilter, 178

Microsoft Office icons, adding to buttons (on ribbon), 503-504

new features, 550

if statements

Exit Do statements in, 76

in If...Then...Else constructs, 81-82

in JavaScript, 539

nesting, 84-86

If...Then...Else constructs, 81-82

conditions in, 81-82

either/or decisions in, 82

ElseIf statements in, 82

End If statements in, 81

ignoring errors, 484-486

illegal qualified name character error message, 506-507

illegally closing userforms, 169-170

images, adding

to buttons (on ribbon), 503-505

to userforms, 458-459

Immediate window, 41-42

importing

CSV files, 254

from text files, 393

into column sets, 402-403

into Data Model with Power Query, 403-404

delimited files, 397-399

file types available, 393

fixed-width files, 393-397

more than 1,048,576 rows, 399-404

reading one row at a time, 400-401

improving. See optimizing

inactive worksheets, referencing ranges in, 55-56

increment operator (++) in JavaScript, 543

Initialize event (userforms), 155

initializing Office add-ins, 545

input boxes, 151-152

return data types, 152

secure password input, 270-273

InputBox function, 151-152

Insert Function dialog box, 280

inserting

class modules, 131-132

comments for names, 100

events, 110

modules, 15

text in selections (Word), 417-418

installing add-ins, 519-520

interactivity, adding to Office add-ins, 530-532, 535

interface

Excel

Advanced Filter in, 182

extracting unique list of values, 183-184

formula-based conditions, 193-194

Office add-ins, 534

interrupting macros, 111

Intersect method (Range object), creating ranges from overlapping ranges, 62

invalid file format error message, 509

IsEmpty function (Range object), finding empty cells, 62-63

Ivy charts, creating, 305

J

JavaScript

adding interactivity with, 530-532, 535

arrays, 538

case sensitivity, 526, 536

changes for Office add-ins, 544-545

comments, 531, 536

curly braces ({ }) in, 536

custom functions, 525

For each..next statements, 541-542

for loops, 539

functions, 535

if statements, 539

initializing Office add-ins, 545

line breaks, 536

math functions, 543-544

operators, 542-543

reading/writing to worksheets, 545

Select...Case statements, 540-541

semicolons (;) in, 536

spaces in, 536

strings, 537-538

variables, 537

writing to content/task panes, 544

Jet engine, 426

joining

criteria ranges

with logical AND, 191

with logical OR, 190-191

ranges with Union method, 61

K

keyboard shortcuts, running macros, 510

KeyDown event

frames/option buttons, 164

list boxes/combo boxes, 162

MultiPage controls, 169

spin buttons, 166

text box/command button control, 159

userforms, 155

KeyPress event

frames/option buttons, 164

list boxes/combo boxes, 162

MultiPage controls, 169

spin buttons, 167

text box/command button control, 159

userforms, 155

KeyUp event

frames/option buttons, 164

list boxes/combo boxes, 162

MultiPage controls, 169

spin buttons, 167

text box/command button control, 159

userforms, 155

L

label controls, 157-159

labels in sparklines, viewing, 365

last data row, finding in recorded code, 47-48

late binding, 407, 410

Layout event

frames, 164

MultiPage controls, 169

userforms, 155

Layout group (Design tab) for pivot tables, 248

layout settings for pivot tables, 248-249

libraries for object models, setting priority, 409

line breaks in JavaScript, 536

line continuation, 18

line settings, formatting charts, 322

line sparklines, 353

list boxes

combo boxes versus, 160-161

events, 162

ListCount property, 162

multicolumn, 464-465

MultiSelect property, 161-162

ListCount property (list boxes), 162

listing files in directory, 251-253

listings

Data Model pivot table, 245-246

pivot table generation, 214-215

pivot table slicers, 236-238

pivot table static summary, 216-217

pivot table timelines, 239-241

replicating pivot table reports, 224-227

local names, 97-98

creating, 98

reserved, 104-105

lock types, 428

logical AND, joining criteria ranges with, 191

logical operators in JavaScript, 542-543

logical OR, joining criteria ranges with, 190-191

loops. see also flow control

breaking out, 539

Do...Loop, 75-77

exiting, 76-77

Until clause in, 77-78

While clause in, 77-78

For Each...Loop, 79-80

for loops in JavaScript, 539

For...Next, 69-71

exiting early, 73-74

nesting, 74

Step clause in For statement, 72-73

variables in For statement, 71-72

Go To Special dialog box versus, 180-181

replacing with AutoFilter, 173-176

While...Wend, 79

Lotus 1-2-3 macro recorder, Excel macro recorder versus, 1, 24

M

M language, 375

Macintosh computers, compatibility, 492

macro buttons, creating

on Quick Access Toolbar, 11

on ribbon, 10

macro recorder, 8

cleaning up code, tips for, 46-52

Developer tab icons, 4

examining code, 33-34

breakpoints, 40

defined constants, 35-37

in Immediate window, 41-42

moving forward/backward in code, 40

optional parameters, 34

properties returning objects, 38

running code while stepping, 41

stepping through code, 38-40

with ToolTips, 42

in Watches window, 43-45

fields in Record Macro dialog box, 9

as help resource, 32

limitations of, 1-2, 15-16

absolute references, 19-20

AutoSum, 23-24

preparations for recording, 16-17

Quick Analysis, 24-25

recording macro, 17

relative references, 20-24

viewing code in Programming window, 17-19

tips for, 25-26

macros

assigning

to form controls, 12-13

to shortcut keys, 9

editing

Project Explorer, 14-15

Properties window, 15

VB Editor interface, 13-14

VB Editor settings, 14

in hidden workbooks, 522-523

interrupting, 111

pausing, 487-488

restarting, 111

running

with ActiveX controls, 512-513

with command buttons, 510-511

with form controls, 12-13

with hyperlinks, 513-514

with keyboard shortcuts, 510

with macro button on Quick Access Toolbar, 11

with macro button on ribbon, 10

with shapes, 511-512

with shortcut keys, 10

saving, 9

scheduling, 381

canceling scheduled, 382-383

for every two minutes, 385

for x minutes in future, 383-384

Ready mode, 382

verbal reminders, 384-385

windows of time for, 382

security, 5

adding trusted locations, 6-7

enabling/disabling macros, 7-8

shortcut keys, changing, 18

testing, 19

manually filtering pivot tables, 227-228

map charts, creating, 326

map() function (JavaScript), 544

markers in sparklines, viewing, 365-366

matching records, returning all with Advanced Filter, 200

copying all columns, 200-201

copying subset of columns, 201-203

creating individual reports, 203-207

math functions in JavaScript, 543-544

mathematical operators in JavaScript, 542-543

matrix. See arrays

max values, returning addresses of duplicates, 301-302

MDB (multidimensional database) files, 425

creating shared databases, 427-428

database connection terminology, 428-429

fields

checking for existence, 438-439

creating, 440

records

adding, 430-431

deleting, 435

retrieving, 431-433

summarizing, 436-437

updating, 433-435

tables

checking for existence, 437-438

creating, 439

memory, reading/parsing text files in, 254-255

message boxes, 152

errors versus, 487

method range of object global failed (error 1004), 489-490

methods, 28

parameters, 29-30

Microsoft Access. See Access

Microsoft ActiveX Data Objects Library, 426

Microsoft Jet Database Engine, 426

Microsoft Office icons, adding to buttons (on ribbon), 503-504

Microsoft Office Trusted Location dialog box, 6

Microsoft Scripting Runtime reference library, 284

military time, formatting cells as, 115-116

minimizing duplicate ActiveX label code, 144-146

minutes in future, scheduled macros for, 383-384

mixed alphanumeric data, sorting, 298-300

mixed references with R1C1 references, 92-93

mixed text, retrieving numbers from, 294-295

mixing icon sets, 343-344

modeless userforms, 453-454

modules, inserting, 15

MouseDown event

frames/option buttons, 164

graphics, 165

label/text box/command button control, 159

list boxes/combo boxes, 162

MultiPage controls, 169

userforms, 155

MouseMove event

frames/option buttons, 164

graphics, 165

label/text box/command button control, 159

list boxes/combo boxes, 162

MultiPage controls, 169

userforms, 155

MouseUp event

frames/option buttons, 164

graphics, 165

label/command button control, 159

label/text box/command button control, 159

list boxes/combo boxes, 162

MultiPage controls, 169

userforms, 155

moving

forward/backward in code, 40

part of pivot table, 215

MsgBox function, 152

multicolumn list boxes, 464-465

multidimensional arrays, declaring, 124-125

multidimensional database files. See MDB

MultiPage controls, 167-169, 446

multiple A1 references, replacing with single R1C1 reference, 93-95

multiple actions in recorded code, 50

multiple characters, substituting, 293-294

multiple colors for data bars, 341-343

multiple error handlers, 484

multiple fields, extracting unique list of values, 187-188

multiple items, selecting with AutoFilter, 176-177

multiple queries for web data, 377-378

multiple value fields in pivot tables, 218-219

multiplication tables, building, 93-95

MultiSelect property (list boxes), 161-162

N

Name Manager dialog box, 97-98

name of workbook, setting in cell, 282

named ranges

creating, 98-99

referencing, 54-55

for VLOOKUP() function, 106-108

names

adding, 98-99

of arrays, creating, 104

capabilities of, 100

checking for existence, 106

comments, adding to, 100

deleting, 100

of formulas, creating, 101

global, 97-98

hiding, 105

local, 97-98

of numbers, creating, 103

renaming, 99

reserved, 104-105

of strings, creating, 101-103

of tables, creating, 103-104

values, storing with, 102

navigating

documents (Word) with bookmarks, 421-422

selections (Word), 417

navigation keys in recorded macros, 26

nesting

For...Next loops, 74

If statements, 84-86

network files, checking if open, 473

network requirements for Office add-ins, 526-529

new features, 547

3D Models, 551

array formulas, 549

charts, 549-550

icons, 550

pivot tables, 209-210, 550

Quick Analysis tool, 549

ribbon, 548

single-document interface (SDI), 548-549

slicers, 550

SmartArt, 551

New keyword, referencing Word, 410

Next statements in For...Next loops, 69-71

noncontiguous ranges, selecting, 66

nonzero-length cells, finding first in range, 292-293

Notepad, 526

Notepad++, 494, 526

NOW function, 287

NumberFormat property (FormatConditions object), 350-351

numbers

names, creating, 103

retrieving from mixed text, 294-295

week numbers, converting to dates, 295-296

O

Object Browser, 45-46

retrieving constants, 413-414

object models, 407, 551

priority of libraries, setting, 409

Word, 414-415

bookmarks, 421-422

CreateObject function, 411

Document object, 415-417

early binding, 407-409

GetObject function, 411-412

late binding, 410

New keyword, 410

Range object, 418-421

retrieving constant values, 412-414

Selection object, 417-418

object variables, 79-80

object-oriented languages

parts of speech analogy, 28-31

procedural languages versus, 27-28

objects, 28

collections versus, 29

custom. See custom objects

properties, 31

returned by properties, 38

watches on, 44-45

Office 365 subscription

Excel 2019 versus, 547

Power BI Custom Visuals support, 306

Office add-ins, 525

adding interactivity, 530-532, 535

case sensitivity, 526

content/task panes, writing to, 544

creating, 526-530

HTML in, 532

buttons, 533-534

CSS files, 534

tags, 533

initializing, 545

interface types, 534

JavaScript changes for, 544-545. see also JavaScript

network requirements, 526-529

XML in, 534-535

Office Add-Ins dialog box, refreshing, 535

Office icons, adding to buttons (on ribbon), 503-504

Offset property (Range object), 175

referencing ranges, 58-59

OLAP pivot tables, filtering, 266-268

On Error Go To syntax, 482-483

On Error Resume Next syntax, 484-485

online data. See web data

OnTime method, 381

canceling scheduled macros, 382-383

for every two minutes, 385

for x minutes in future, 383-384

Ready mode, 382

verbal reminders, 384-385

windows of time in, 382

Open method (Document object), 416

open network files, checking for, 473

open workbooks, checking for, 282-283

opening

delimited text files, 397-399

documents (Word), 416

files in Notepad, 526

fixed-width text files, 393-397

VB Editor, 18

workbooks when customizing ribbon, 502

OpenText method, 33, 35, 37, 393

delimited text files, 397-399

file types for, 393

fixed-width text files, 393-397

importing more than 1,048,576 rows, 399

operators in JavaScript, 542-543

optimistic lock types, 428

optimizing code with arrays, 128

option buttons, 163

events, 163-164

GroupName property, 163

optional parameters in Help topics, 34

OR, joining criteria ranges with, 190-191

organizing controls on UserForm toolbar, 443-444

overlapping ranges, creating ranges from, 62

P

Page Setup dialog box, ignoring errors, 485-486

parameters, 29-30

for events, 110

optional, 34

parsing text files in memory, 254-255

parts of speech analogy (object-oriented languages), 28-31

pass-through queries, 429

passing

arrays to functions, 130

values to/from arrays, 130

passwords

for add-ins, 520

cracking, 490-491

in Excel versions, 491-492

secure password input, 270-273

pasting in recorded code, 49

patterns, formatting charts, 321

pausing macros, 487-488

percentages, changing pivot table calculations to, 221-223

performance of code, optimizing with arrays, 128

permanent date/time, retrieving, 287

Personal Macro Workbook, 9

pessimistic lock types, 429

pictures, formatting charts, 321

pivot cache

defining, 210-211, 243

deleting, 216

pivot table events (workbook-level), list of, 113-114

pivot tables, 209

AutoSort, 224

calculated fields in, 246-247

calculated items in, 247

calculations, changing to percentages, 221-223

configuring, 211-212

converting to values, 215-217

creating, 211-212

daily dates, grouping, 219-221

data area, adding fields, 212-215

Data Model example code, 244-246

Data Model fields, adding, 243

data sets, replicating reports for, 224-227

data visualizations in, 249-250

drilling down, 265-266

filtering

with AutoShow, 232-234

with conceptual filters, 228-231

manually, 227-228

with Search box, 232

with slicers, 234-238

with Timeline slicers, 238-241

finding size of, 215-217

history in Excel, 209-210

Layout group (Design tab), 248

moving/changing part of, 215

new features, 550

OLAP pivot tables, filtering, 266-268

pivot cache

defining, 210-211, 243

deleting, 216

record sets, filtering, 247

reports, layout settings, 248-249

subtotals, suppressing, 249

value fields

adding to Data Model, 243-244

multiple, 218-219

values area, eliminating blank cells, 223-224

VBA terminology for, 210

playing sounds, 477

plus sign (+) in JavaScript, 537

Power BI Custom Visuals, 306

Power Query add-in, 375

importing text files into Data Model, 403-404

preparing to record macros, 16-17

Preserve keyword, 129

Print_Area reserved name, 105

Print_Titles reserved name, 105

printing documents (Word), 417

PrintOut method (Document object), 417

priority of libraries, setting, 409

private variables, 135

procedural languages, object-oriented languages versus, 27-28

procedures, preventing recursive calling, 116. see also events

ProgIDs for controls, 458

programming

controls, 156

userforms, 154-156

Programming window, viewing code in, 17-19

progress indicators, creating, 269-270

Project Explorer, 14-15

properties, 31, 135. see also variables

custom, creating, 146-149

returning objects, 38

Properties window, 15

closing, 513

Property Get procedures, 137

Property Let procedures, 136

Property Set procedures, 137

protecting

code

disadvantages of, 490

Excel password versions, 491-492

password cracking, 490-491

hidden names, 106

public variables, 135

publishing web data

Excel as content management system, 388-390

via FTP, 390-391

saving as HTML, 386-387

writing macro for, 387

purposely encountering errors, 486-487

Q

QueryClose event (userforms), 155, 169-170

querying

variables

in Immediate window, 41-42

with ToolTips, 42

in Watches window, 43

web data, 375, 377

cleaning up macro, 379-380

examples of, 380-381

finding results in, 378-379

with multiple queries, 377-378

scheduling retrieval, 381

Quick Access Toolbar, macro buttons on, 11

Quick Analysis tool, 549

in recorded macros, 24-25

quotation marks (““) in JavaScript, 537

R

R1C1 references

A1 references versus, 87-88

absolute references with, 92

with array formulas, 96

associating column numbers with column names, 95

converting formulas to, 96

copying formulas, 89-91

for entire columns/rows, 93

mixed references with, 92-93

in recorded code, 49

relative references with, 91-92

replacing multiple A1 references, 93-95

toggling, 88-89

RAND function, 303

random numbers, generating static, 303

Range object, 541

Areas collection, selecting noncontiguous ranges, 66

Cells property, selecting ranges, 57-58

Columns property, referencing ranges, 61

CurrentRegion property, selecting ranges, 63

Intersect method, creating ranges from overlapping ranges, 62

IsEmpty function, finding empty cells, 62-63

Offset property, referencing ranges, 58-59

referencing, 53-54

named ranges, 54-55

in other worksheets, 55-56

relative to other ranges, 56

syntax, 54

Resize property, resizing ranges, 60-61

Rows property, referencing ranges, 61

SpecialCells method, selecting specific cells, 63-65

Union method, joining ranges, 61

in Word, 418

defining ranges, 418-419

formatting ranges, 419-421

ranges, 53

adding

color scales to, 336-337

data bars to, 331-335

icon sets to, 337-340

creating from overlapping ranges, 62

finding

empty cells in, 62-63

first nonzero-length cell in, 292-293

joining with Union method, 61

multiple data bar colors in, 341-343

named ranges

creating, 98-99

for VLOOKUP() function, 106-108

referencing

with Columns property, 61

named ranges, 54-55

with Offset property, 58-59

in other worksheets, 55-56

in recorded code, 47

relative to other ranges, 56

with Rows property, 61

syntax, 54

resizing with Resize property, 60-61

selecting

with Cells property, 57-58

with CurrentRegion property, 63

noncontiguous ranges, 66

specific cells with SpecialCells method, 63-65

sorting

by custom sort order, 268-269

numerically then alphabetically, 298-300

subsets of, creating icon sets for, 340-341

tables

creating, 103-104

referencing, 66-67

selecting, 66

reading. see also importing

from worksheets with JavaScript, 545

text files into memory, 254-255

Ready mode, scheduled macros and, 382

Record Macro dialog box, 8-9, 17

record sets, 428

filtering in pivot tables, 247

recording macros, 8

cleaning up code, tips for, 46-52

Developer tab icons, 4

examining code, 33-34

breakpoints, 40

defined constants, 35-37

in Immediate window, 41-42

moving forward/backward in code, 40

optional parameters, 34

properties returning objects, 38

running code while stepping, 41

stepping through code, 38-40

with ToolTips, 42

in Watches window, 43-45

fields in Record Macro dialog box, 9

as help resource, 32

limitations of, 1-2, 15-16

absolute references, 19-20

AutoSum, 23-24

preparations for recording, 16-17

Quick Analysis, 24-25

recording macro, 17

relative references, 20-24

viewing code in Programming window, 17-19

tips for, 25-26

records

copying to worksheets, 257-258

counting in pivot tables, 219

database

adding, 430-431

deleting, 435

retrieving, 431-433

summarizing, 436-437

updating, 433-435

recursive functions, 284

recursive procedure calling, preventing, 116

RefEdit controls, 448-449

references

R1C1

A1 versus, 87-88

absolute references with, 92

with array formulas, 96

associating column numbers with column names, 95

converting formulas to, 96

copying formulas, 89-91

for entire columns/rows, 93

mixed references with, 92-93

relative references with, 91-92

replacing multiple A1 references, 93-95

toggling, 88-89

to ranges in recorded code, 47

referencing

custom objects, 137-138

Range object, 53-54

with Columns property, 61

named ranges, 54-55

with Offset property, 58-59

in other worksheets, 55-56

relative to other ranges, 56

with Rows property, 61

syntax, 54

tables, 66-67

Word, 407

CreateObject function, 411

early binding, 407-409

GetObject function, 411-412

late binding, 410

New keyword, 410

retrieving constant values, 412-414

refreshing Office Add-Ins dialog box, 535

relationships, creating between tables in Data Model, 242

relative references

with R1C1 references, 91-92

to ranges, 56

in recorded macros, 20-25

RELS file, 501-502

reminders (verbal), scheduling, 384-385

RemoveControl event

frames, 164

MultiPage controls, 169

userforms, 155

removing. See deleting

renaming

controls, 156

names, 99

workbooks when customizing ribbon, 502

reordering columns with Advanced Filter, 201-203

replacing

loops with AutoFilter, 173-176

multiple A1 references with single R1C1 reference, 93-95

replicating reports in pivot tables, 224-227

reports

creating individual with Advanced Filter, 203-207

from pivot tables, layout settings, 248-249

replicating in pivot tables, 224-227

required fields in userforms, 169

requiring variable declarations, 14

reserved names, 104-105

Reset button (VB Editor), 480

Reset command (stopping code), 40

resetting table formatting, 275

Resize event (userforms), 156

Resize property (Range object), 60-61

resizing

comments, 259-260

ranges with Resize property, 60-61

userforms, 457

resolution (of display), returning, 474-475

resources for information. See help resources

restarting macros, 111

Restore Down icon (arranging window), 39

retrieving

array data, 126-127

constant values when referencing Word, 412-414

numbers from mixed text, 294-295

permanent date/time for workbooks, 287

records (database), 431-433

saved date/time for workbooks, 286

user IDs, 285-286

web data, 375, 377

cleaning up macro, 379-380

examples of, 380-381

finding results in, 378-379

with multiple queries, 377-378

scheduling retrieval, 381

return data types for input boxes, 152

returning

all matching records with Advanced Filter, 200

copying all columns, 200-201

copying subset of columns, 201-203

creating individual reports, 203-207

cell addresses of duplicate max values, 301-302

column letter of cell addresses, 302-303

computer name, 472-473

display resolution, 474

hyperlink addresses, 302

reversing cell contents, 300-301

RGB colors, 362, 364

RGB function, 333-364

ribbon

customizing, 493

accessing file structure, 501

adding button images, 503-505

adding controls, 496-500

creating customui folder/file, 494-495

creating tabs/groups, 495-496

RELS file, 501-502

renaming/opening workbooks, 502

troubleshooting error messages, 493, 505-509

visibility of ribbon, 494

macro buttons on, 10

new features, 548

RibbonX Visual Designer, 503

row fields in pivot tables, suppressing subtotals, 249

RowGrand property (pivot tables), 248

rows

changing to variables in recorded code, 49

formatting with AutoFilter, 173-176

hiding with Go To Special dialog box, 180-181

highlighting, 350

referencing with R1C1 references, 93

Rows property (Range object), referencing ranges, 61

running

code while stepping, 41

macros

with ActiveX controls, 512-513

with command buttons, 510-511

with form controls, 12,-13

with hyperlinks, 513-514

with keyboard shortcuts, 510

with macro button on Quick Access Toolbar, 11

with macro button on ribbon, 10

with shapes, 511-512

with shortcut keys, 10

running timers, creating, 476-477

runtime, adding controls, 455-461

runtime errors

subscript out of range, 488-489

method range of object global failed, 489-490

troubleshooting, 199-200

VB Editor actions, 479-480

S

Save As command, converting workbooks to add-ins, 517

saved date/time, retrieving, 286

saving

add-in data, 516

files, changing default file type, 5

macros, 9

workbooks as HTML, 386-387

scaling sparklines, 355-359

scheduling macros, 381

canceling scheduled, 382-383

for every two minutes, 385

for x minutes in future, 383-384

Ready mode, 382

verbal reminders, 384-385

windows of time for, 382

Scroll event

frames, 164

MultiPage controls, 169

userforms, 156

scrollbars, as sliders, 450-451

SDI (single-document interface), 548-549

Search box

filtering pivot tables, 232

selecting with in AutoFilter, 177

searching for strings, 300

secure password input, 270-273

security

add-ins, 520

macros, 5

adding trusted locations, 6-7

enabling/disabling macros, 7-8

passwords

for add-ins, 520

cracking, 490-491

in Excel versions, 491-492

secure password input, 270-273

protecting code

disadvantages of, 490

Excel password versions, 491-492

password cracking, 490-491

Select Case...End Select constructs, 83-84

Select...Case statements

in JavaScript, 540-541

in worksheets, 303-304

selecting

cells with SpecialCells, 274-275

files in userforms, 170-171

multiple items with AutoFilter, 176-177

ranges

with Cells property, 57-58

with CurrentRegion property, 63

noncontiguous ranges, 66

specific cells with SpecialCells method, 63-65

with Search box in AutoFilter, 177

tables, 66

visible cells, 179-180

Selection object (Word), 417

inserting text, 417-418

navigating, 417

Selection property, 38

selections, deleting in recorded code, 46-47

semicolons (;) in JavaScript, 536

separating worksheets into workbooks, 255-256

Set statements for object variables, 80

SetElement method (formatting charts), 314-319

shapes

assigning macros to, 12

running macros from, 511-512

shared Access databases, creating, 427-428

sharing

UDFs (user-defined functions), 281

workbooks, 425

sheet events, workbook-level, 113-114

shortcut keys

assigning to macros, 9

changing for macros, 18

running macros, 10

ShowAllData method, 200

ShowDetail property (pivot tables), 247

single rows, importing text files by, 400-401

single-document interface (SDI), 548-549

size of pivot tables, finding, 215-217

skipping fields during imports, 395

slicer cache, defining, 235

slicers

filtering pivot tables, 234-238

formatting, 238

new features, 550

Timeline slicers, 238-241

sliders, scrollbars as, 450-451

SmartArt

assigning macros to, 12

new features, 551

sorting

columns, 296-298

pivot tables, 224

ranges

by custom sort order, 268-269

numerically then alphabetically, 298-300

sounds, playing, 477

spaces in JavaScript, 536

SparklineGroup object, 353

sparklines, 353, 550

creating, 353-355

for dashboard, 369-373

formatting, 359

with RGB colors, 362, 364

sparkline elements, 364-366

with theme colors, 359-362

win/loss charts, 366-367

scaling, 355-359

tips for, 368-369

types of, 353

Speak On Enter feature, 384

SpecialCells method (Range object), selecting specific cells, 63-65, 274-275

speeding up. See optimizing

spin buttons, 165-167

SpinDown event (spin buttons), 167

SpinUp event (spin buttons), 167

spreadsheets. See worksheets

SQL Server, 440-442

SQL statements

pass-through queries, 429

viewing, 431

square brackets ([ ]), as Evaluate method, 103

standard add-ins. See add-ins

standard modules, creating collections, 139-140

states, enabling/disabling, 263, 265

static cursors, 428

static random numbers, generating, 303

Step clause in For statement in For...Next loops, 72-73

stepping through code, 38-41

storing values with names, 102

strings

delimited strings, extracting elements from, 296

in JavaScript, 537-538

names, creating, 101-103

searching text for, 300

styles (chart), list of, 307-310

subscript out of range (error 9), 488-489

subset of columns, copying with Advanced Filter, 201-203

subsets of ranges, creating icon sets for, 340-341

substituting multiple characters, 293-294

SubtotalLocation property (pivot tables), 248

subtotals, suppressing in pivot tables, 249

summarizing records (database), 436-437

summing cells based on color, 289-290

suppressing

alerts, 486

subtotals in pivot tables, 249

switch() statement in JavaScript, 540-541

switching to SQL Server, 440-442

T

tab order in userforms, 462-463

tables

adding to Data Model, 242

creating, 103-104

creating relationships in Data Model, 242

database

checking for existence, 437-438

creating, 439

exporting to XML, 258-259

referencing, 66-67

resetting formatting, 275

selecting, 66

tabs (on ribbon), creating, 495-496

TabStrip controls, 446-448

Tag property, 453

tags (HTML), 533

task pane (Office add-ins), 534, 544

Terminate event (userforms), 156

test expressions, 83

testing macros, 19

text

changing case, 273-274

highlighting cells based on, 348

inserting in selections (Word), 417-418

retrieving numbers from, 294-295

searching for strings, 300

text box controls, 157-159

text boxes, assigning macros to, 12

text editors, case sensitivity in, 526

text fields, troubleshooting formulas in, 396

text files

importing from, 393

into column sets, 402-403

into Data Model with Power Query, 403-404

delimited files, 397-399

file types available, 393

fixed-width files, 393-397

more than 1,048,576 rows, 399-404

reading one row at a time, 400-401

reading/parsing in memory, 254-255

writing, 404-405

Text Import Wizard, 16, 35, 37

textures, formatting charts, 320

theme colors, 359-362

Then statements in If...Then...Else constructs, 81-82

time formats, military time, 115-116

time windows for scheduled macros, 382

Timeline slicers, 238-241

timers, creating running, 476-477

tip text in userforms, 462

titles (chart), specifying, 311-312

toggle buttons, 449-450

toggling R1C1 references, 88-89

ToolTips in VB Editor, 42

Top 10 AutoShow, filtering pivot tables, 232-234

top/bottom rules, 330, 345

tracking user changes, 262-263

training clients in error handling, 487

transparency of userforms, 465-466

TrapAppEvent procedure, 133

troubleshooting. see also error handling

1004 runtime error, 199-200

Compatibility mode, 552

error messages on ribbon, 493, 505-509

formulas in text fields, 396

new controls, 157

trusted locations, adding, 6-7

two minutes, scheduled macros for, 385

Type...End Type statements, 146

TypeText method (Selection object), 417-418

U

UDFs (user-defined functions)

cells

finding first nonzero-length in range, 292-293

returning addresses of duplicate max values, 301-302

returning column letter of address, 302-303

returning hyperlink addresses, 302

reversing contents, 300-301

summing based on color, 289-290

characters, substituting multiple, 293-294

columns, sorting and concatenating, 296-298

creating, 279-281

delimited strings, extracting elements from, 296

email addresses, validating, 287-289

in JavaScript, 525

random numbers, generating static, 303

ranges, sorting numerically then alphabetically, 298-300

sharing, 281

text

retrieving numbers from, 294-295

searching for strings, 300

user IDs, retrieving, 285-286

values

counting unique, 290-291

removing duplicates, 291-292

week numbers, converting to dates, 295-296

workbooks

checking for worksheet existence, 283-284

checking if open, 282-283

counting in directory, 284-285

retrieving permanent date/time, 287

retrieving saved date/time, 286

setting file path in cell, 282

setting name in cell, 282

worksheets, Select...Case statements in, 303-304

UDTs (user-defined types), 146-149

Union method (Range object), joining ranges, 61

unique cells, highlighting, 346-347

unique list of values, extracting, 182

with Excel interface, 183-184

for multiple fields, 187-188

with VBA code, 184-187

unique values

counting, 290-291

highlighting first, 349-350

Until clause in Do...Loop loops, 77-78

Unviewable+ VBA Project software, 490

updating records (database), 433-435

user changes, tracking, 262-263

user IDs, retrieving, 285-286

user-defined functions (UDFs). See UDFs

user-defined types (UDTs), 146-149

UserForm toolbar, 443-444

userforms, 151

calling, 154

closing illegally, 169-170

controls

adding at runtime, 455-461

check boxes, 444-446

combo boxes, 160-162

command buttons, 157-159

frames, 163-164

graphics, 164-165

grouping into collections, 451-453

labels, 157-159

list boxes, 160-162

multicolumn list boxes, 464-465

MultiPage, 167-169, 446

option buttons, 163-164

ProgIDs for, 458

programming, 156

RefEdit, 448-449

renaming, 156

scrollbars as sliders, 450-451

spin buttons, 165-167

TabStrip, 446-448

text boxes, 157-159

toggle buttons, 449-450

troubleshooting new controls, 157

creating, 153-154

disabling X button, 475-476

error handling, 481-482

help features

accelerator keys, 461-462

coloring active control, 463-464

tab order, 462-463

tip text, 462

hiding, 154

hyperlinks in, 454-455

images, adding, 458-459

input boxes, 151-152

message boxes, 152

modeless, 453-454

programming, 154-156

required fields, 169

resizing, 457

selecting files in, 170-171

transparency, 465-466

UserForm toolbar, 443-444

V

validating email addresses, 287-289

value fields in pivot tables

adding in Data Model, 243-244

multiple fields, 218-219

values

arrays

filling, 125-126

passing to/from, 130

converting pivot tables to, 215-217

counting unique, 290-291

custom number formats, 350-351

extracting unique, 182

with Excel interface, 183-184

for multiple fields, 187-188

with VBA code, 184-187

first unique, highlighting, 349-350

highlighting cells based on, 347

removing duplicates, 291-292

storing with names, 102

values area of pivot tables, eliminating blank cells, 223-224

variables. see also properties

arrays. See arrays

changing rows/formulas to in recorded code, 49

declaring, 14, 79

in For statement in For...Next loops, 71-72

in JavaScript, 537

object variables, 79-80

querying

in Immediate window, 41-42

with ToolTips, 42

in Watches window, 43

VB Editor

converting workbooks to add-ins, 518

debugging tools

breakpoints, 40

Immediate window, 41-42

moving forward/backward in code, 40

running code while stepping, 41

stepping through code, 38-40

ToolTips, 42

Watches window, 43-45

error handling in, 479-482

interface, 13-14

Object Browser, 45-46

opening, 18

Programming window, viewing code in, 17-19

Project Explorer, 14-15

Properties window, 15

settings, 14

VBA (Visual Basic for Applications)

barriers to entry, 1

macro recorder limitations, 1-2

Visual Basic versus BASIC, 2

data visualization methods/properties, 330-331

Developer tab, enabling, 3-4

help resources

Help topics, 32-33

macro recorder, 32

Object Browser, 45-46

learning curve, 2-3

new features, 547

3D Models, 551

array formulas, 549

charts, 549-550

icons, 550

pivot tables, 550

Quick Analysis tool, 549

ribbon, 548

single-document interface (SDI), 548-549

slicers, 550

SmartArt, 551

object models, 407

as object-oriented language

parts of speech analogy, 28-31

procedural languages versus, 27-28

pivot table terminology, 210

power of, 1

protecting code

disadvantages of, 490

Excel password versions, 491-492

password cracking, 490-491

VBA Extensibility, adding code to workbooks, 276-277

verbal reminders, scheduling, 384-385

verifying workbook version

with Excel8CompatibilityMode property, 553

with Version property, 552

Version property, 552

versions of Excel

error handling, 492

password schemes in, 491-492

pivot tables in, 209-210

verifying

with Excel8CompatibilityMode property, 553

with Version property, 552

viewing

add-ins, 519

all records after filter in place, 200

custom ribbon, 494

Developer tab, 3-4

events, 110

horizontal axis in sparklines, 364-365

macro code in Programming window, 17-19

Project Explorer, 14

sparkline labels, 365

sparkline markers, 365-366

SQL statements, 431

VBA and Excel windows, 39

Word instances, 411

visible cells, selecting, 179-180

Visual Basic, BASIC versus, 2

Visual Basic for Applications. See VBA (Visual Basic for Applications)

visualizations. See data visualizations

VLOOKUP() function

finding results in web data, 378

named ranges for, 106-108

W

warnings, suppressing, 486

Watches window, 43-45

retrieving constants, 413

waterfall charts, creating, 326-328

WCL_FTP utility, 390-391

web data

publishing

Excel as content management system, 388-390

via FTP, 390-391

saving as HTML, 386-387

writing macro for, 387

retrieving, 375, 377

cleaning up macro, 379-380

examples of, 380-381

finding results in, 378-379

with multiple queries, 377-378

scheduling retrieval, 381

week numbers, converting to dates, 295-296

Wend statements in While...Wend loops, 79

While clause in Do...Loop loops, 77-78

While...Wend loops, 79

win/loss sparklines, 353, 366-367

windows (VBA and Excel), viewing, 39

Windows API. See API (application programming interface)

Windows computers, compatibility, 492

windows of time for scheduled macros, 382

WinWord.exe, 411

With...End With statements in recorded code, 50

Word

object model, 414-415

bookmarks, 421-422

Document object, 415-417

Range object, 418-421

Selection object, 417-418

referencing from Excel, 407

CreateObject function, 411

early binding, 407-409

GetObject function, 411-412

late binding, 410

New keyword, 410

retrieving constant values, 412-414

viewing instances, 411

workbook events, list of, 111-113

workbook-level sheet events, list of, 113-114

workbooks

adding code with VBA Extensibility, 276-277

checking if open, 282-283

combining, 256-257

Compatibility mode, troubleshooting, 552

converting to add-ins, 516-517

with Save As, 517

with VB Editor, 518

counting in directory, 284-285

file structure, accessing, 501

hiding, 521-523

renaming/opening when customizing ribbon, 502

retrieving permanent date/time, 287

retrieving saved date/time, 286

saving as HTML, 386-387

setting file path in cell, 282

setting name in cell, 282

sharing, 425

user changes, tracking, 262-263

verifying version

with Excel8CompatibilityMode property, 553

with Version property, 552

worksheets. See worksheets

worksheet events, list of, 114-115

worksheets

as arrays, 124

checking for existence, 283-284

combining into single workbook, 256-257

copying data to, 257-258

inactive worksheets, referencing ranges in, 55-56

reading/writing with JavaScript, 545

Select...Case statements in, 303-304

separating into workbooks, 255-256

user changes, tracking, 262-263

writing

to content/task panes with JavaScript, 544

text files, 404-405

to worksheets with JavaScript, 545

X-Y-Z

X button in userforms, disabling, 475-476

.xlsb (Excel Binary Workbook) file type, 5

.xls (Excel 97-2003 Workbook) file type, 5

.xlsm (Excel Macro-Enabled Workbook) file type, 4-5

.xlsx (Excel Workbook) file type, 4

XML

case sensitivity, 526

exporting tables to, 258-259

in Office add-ins, 534-535

Zoom event

frames, 164

MultiPage controls, 169

userforms, 156

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

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