For Each Loop

amfroehlich

Board Regular
Joined
Jul 14, 2004
Messages
192
I am wanting to write a for each loop that changes on value of one feild in a tabular form.

Example:

For Each PrimaryKey in Form
if checkbox.value = true then
Status = "Complete" 'Change vaule of Status to complete.
end if
Loop

How do i do this with code?

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
You've almost got the syntax right for a For Each loop - just replace Loop with Next.

Yo help further more information/explanation is needed.

What is PrimaryKey? A control/field on a form?

What is checkbox?

What is Status?
 
Upvote 0
i have a text box with the dual primary key on the form

I have a check box next to every list of items on the form
if the check boxed is check i want to save the information if is not check leave it alone.

Status is the field that i want to change...
 
Upvote 0
Why do you want/need to use a loop?
 
Upvote 0
In tabular form each record has it's own form.controls and you should only need to write code once, for the form rather than each record.

Unless I'm not quite understanding you.
 
Upvote 0

Forum statistics

Threads
1,221,834
Messages
6,162,268
Members
451,758
Latest member
lmcquade91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top