Excel Code Samples

  • Thread starter Thread starter HSalim[MVP]
  • Start date Start date
H

HSalim[MVP]

Good morning All

Where can I find guidance and code samples to help me perform the following
tasks using Excel VBA
1. iterate through a worksheet cell by cell
2. replace values, parse values and conditionally set flags in mew columns

Thanks in advance

Habib
 
John Walkenbach's site
http://www.j-walk.com/ss/excel
go to the developers section

Chip Pearson's site
http://www.cpearson.com/excel/topics.htm


to loop through all cells

for each cell in Activesheet.UsedRange
if cell.value = 10 then
msgbox cell.Address(0,0)
end if
Next


for each sh in Activeworkbook.Worksheets
for each cell in sh.UsedRange
if cell.value = 10 then
msgbox cell.Address(0,0,xlA1,True)
end if
Next
Next
 
for a good example of finding information on a worksheet, see the help
example in the VBA for the FINDNEXT method of the range object.

Excel also has a macro recorder which is good for getting some insights in
to the code to use. It produces bad code because it records your actions
like selecting cells and moving around the sheet, but it is good for showing
the properties and methods and some of the arguments.

You can always post here with specific questions.

Debra Dalgleish's site has some good information for major topics like pivot
tables, conditional formatting, data validation and Filters and some others.
http://www.contextures.com then go to tech tips.
 
Tom,
Thanks for the links. I was able to achieve what I wanted.

Regards
Habib

: for a good example of finding information on a worksheet, see the help
: example in the VBA for the FINDNEXT method of the range object.
:
: Excel also has a macro recorder which is good for getting some insights in
: to the code to use. It produces bad code because it records your actions
: like selecting cells and moving around the sheet, but it is good for
showing
: the properties and methods and some of the arguments.
:
: You can always post here with specific questions.
:
: Debra Dalgleish's site has some good information for major topics like
pivot
: tables, conditional formatting, data validation and Filters and some
others.
: http://www.contextures.com then go to tech tips.
:
: --
: Regards,
: Tom Ogilvy
:
:
: : > John Walkenbach's site
: > http://www.j-walk.com/ss/excel
: > go to the developers section
: >
: > Chip Pearson's site
: > http://www.cpearson.com/excel/topics.htm
: >
: >
: > to loop through all cells
: >
: > for each cell in Activesheet.UsedRange
: > if cell.value = 10 then
: > msgbox cell.Address(0,0)
: > end if
: > Next
: >
: >
: > for each sh in Activeworkbook.Worksheets
: > for each cell in sh.UsedRange
: > if cell.value = 10 then
: > msgbox cell.Address(0,0,xlA1,True)
: > end if
: > Next
: > Next
: >
: > --
: > Regards,
: > Tom Ogilvy
: >
: >
: >
: >
: > : > > Good morning All
: > >
: > > Where can I find guidance and code samples to help me perform the
: > following
: > > tasks using Excel VBA
: > > 1. iterate through a worksheet cell by cell
: > > 2. replace values, parse values and conditionally set flags in mew
: columns
: > >
: > > Thanks in advance
: > >
: > > Habib
: > >
: > >
: >
: >
:
:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top