Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default filling a row with data, depending on certain criteria


Hi,

If I want to loop through a column of data and dependant on the value
of the active cell, fill that row with a value, how would I write the
macro? I can loop through data, but am not sure of how to make sure
the active row is filled and no other, then the next cell in the
column is checked and that row is filled according to the value (which
could be different) and so on?

kind regards,
Matt
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default filling a row with data, depending on certain criteria

Pls keep questions in the ng, unless invited otherwise, and please TOP post.

Sub fillcolsif()
For Each c In Range("a2:a10")
If c = "a" Or c = "b" Then
Range(Cells(c.Row, 2), Cells(c.Row, 7)) = "x"
End If
Next
End Sub

I need the macro to look at cell A1 and if the value = "SICK", then
cells B1 to G1 will need to be filled with the value "Absent", if A1 =
"Leave" then again cells B1 to G1 will need to state "Absent". if the
cell value is empty (or the value is anything else), then B1 to G1 can
remain empty. I would then need the macro to proceed to cell A2 and
carry out the same checks, but this time cells B2 to G2 would need to
be completed.

Once all 10 cells A1 to A10 have been checked the macro will end.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...

More info?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"MJKelly" wrote in message
...

Hi,

If I want to loop through a column of data and dependant on the value
of the active cell, fill that row with a value, how would I write the
macro? I can loop through data, but am not sure of how to make sure
the active row is filled and no other, then the next cell in the
column is checked and that row is filled according to the value (which
could be different) and so on?

kind regards,
Matt



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charting depending on criteria & data series name as a column val Mr.LuckyMe Charts and Charting in Excel 2 June 16th 09 02:53 PM
How to move data to another worksheet depending on the criteria harwookf Excel Discussion (Misc queries) 7 November 19th 08 03:29 AM
move data to another sheet depending on criteria harwookf Excel Worksheet Functions 8 October 24th 07 02:40 PM
moving data depending on criteria harwookf Excel Worksheet Functions 1 October 24th 07 02:40 PM
Move data to new sheet depending on criteria enna49 Excel Programming 1 August 8th 06 11:03 AM


All times are GMT +1. The time now is 03:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"