ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   accessing rows with macros (https://www.excelbanter.com/excel-discussion-misc-queries/22521-accessing-rows-macros.html)

Sam

accessing rows with macros
 
Hi,
I'm quite new to excel. I'd like to loop through all the rows in my
sheet and compare the text in the cells of the first column with some
string variable priorly set.
How can I do that ?

Also I would like to disable my cells for editing, so that only my
function run when I click on a button can modify those cells. I've done
it through protecting the sheet from editing, but then even my macro
can't edit the cell without having to enter the password;)

Thx


Bob Phillips


For i = 1 To Cells(Rows.Count,"A").End(xlUp).Row
If Cells(i,"A") = "somevalue" Then
'do something
End If
Next i

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sam" wrote in message
oups.com...
Hi,
I'm quite new to excel. I'd like to loop through all the rows in my
sheet and compare the text in the cells of the first column with some
string variable priorly set.
How can I do that ?

Also I would like to disable my cells for editing, so that only my
function run when I click on a button can modify those cells. I've done
it through protecting the sheet from editing, but then even my macro
can't edit the cell without having to enter the password;)

Thx




Sam

thanks a lot , that works


Bob Phillips

my pleasure

Bob


"Sam" wrote in message
ups.com...
thanks a lot , that works





All times are GMT +1. The time now is 06:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com