ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   moving contents of cells based on criteria (https://www.excelbanter.com/excel-programming/316608-moving-contents-cells-based-criteria.html)

scottwilsonx[_71_]

moving contents of cells based on criteria
 

Hope someone can help with this question:

I have a range of cells between A10:B16.

Based on the information in B10 to B16 (ie in column B) I want a macr
to take the values and drop them into cells A4 to A9 respectively

For example: If b10 does not contain "(A1)" then the value of B10 i
dumped into A5. If B11 does not contain "(A1)" then the value of B1
is dumped into A6 etc.


Is this possible using a loop of some sort ?

Many thanks for your help.

Scot

--
scottwilson
-----------------------------------------------------------------------
scottwilsonx's Profile: http://www.excelforum.com/member.php...fo&userid=1112
View this thread: http://www.excelforum.com/showthread.php?threadid=27774


Bernie Deitrick

moving contents of cells based on criteria
 
Scott,

Sub TryNow()
Dim myCell As Range
Dim i As Integer

Range("A4:A9").ClearContents

i = 1
For Each myCell In Range("B10:B16")
If Not InStr(myCell.Value, "(A1)") 0 Then
Range("A4")(i, 1).Value = myCell.Value
i = i + 1
End If
Next myCell
End Sub

HTH,
Bernie
MS Excel MVP

"scottwilsonx" wrote in message
...

Hope someone can help with this question:

I have a range of cells between A10:B16.

Based on the information in B10 to B16 (ie in column B) I want a macro
to take the values and drop them into cells A4 to A9 respectively

For example: If b10 does not contain "(A1)" then the value of B10 is
dumped into A5. If B11 does not contain "(A1)" then the value of B11
is dumped into A6 etc.


Is this possible using a loop of some sort ?

Many thanks for your help.

Scott


--
scottwilsonx
------------------------------------------------------------------------
scottwilsonx's Profile:

http://www.excelforum.com/member.php...o&userid=11128
View this thread: http://www.excelforum.com/showthread...hreadid=277742





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

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