0% found this document useful (0 votes)
25 views

Selection in Excel VBA

The document provides examples of common Excel VBA commands for selecting cells and ranges, working with worksheets and workbooks, and formatting cells. It shows how to select cells and ranges, insert and format text, switch and rename worksheets, open and close workbooks, and more using VBA. The examples are intended to demonstrate basic VBA syntax and functionality for automating tasks and manipulating Excel objects.

Uploaded by

Zubair Qureshi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Selection in Excel VBA

The document provides examples of common Excel VBA commands for selecting cells and ranges, working with worksheets and workbooks, and formatting cells. It shows how to select cells and ranges, insert and format text, switch and rename worksheets, open and close workbooks, and more using VBA. The examples are intended to demonstrate basic VBA syntax and functionality for automating tasks and manipulating Excel objects.

Uploaded by

Zubair Qureshi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. selection in Excel VBA Select cell a1 Selecting a range Select current cell Select row no.

5 Select columns from a to c Select current row Select 3 columns from current cell Insert text Move down one cell Change font color Change cell format Change style Entire data

Range(a1).select Range(a1:b10).select Activecell.select Rows(5:5).select Columns(A:C).select ActiveCell.EntireRow.Range("1:1").Select ActiveCell.EntireColumn.Range("A:c").Select Activecell.value=some text or Activecell.formulaR1C1=some text Activecell.offset(1,0).range(A1).select Selection.font.colorindex=5 Selection.numberformat=$#,##0.00 Selection.font.bold=true Selection.font.italic=true Selection.font.underline=xlunderlinestylesingle Activecell.currentregion.select

2. Working with worksheets Selecting a worksheet Adding a worksheet Printing a worksheet Previewing a worksheet Renaming a worksheet Deleting a worksheet To switch off the display of messages To move/copy a worksheet 3. Working with workbooks Open a workbook (if workbook contains auto macros, u need to run those auto macros) Close a workbook Adding a new workbook

Sheets(sheet1).select Worksheets(sheet1).select Worksheets.add before:=worksheets(sheet1) Activesheet.printout Activesheet.printpreview Activesheet.name=newname Activesheet.delete Application.displayalert=false Activesheet.move before:=worksheets(sheet3) Workbooks.open filename:= Activeworkbook.runautomacros xlautoopen Activeworkbook.close Workbooks.add

You might also like