ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy cell contents if "x" is present in cell. (https://www.excelbanter.com/excel-programming/358839-copy-cell-contents-if-x-present-cell.html)

Robb27

copy cell contents if "x" is present in cell.
 
I need help with some code.

I have a list of dealers in Column A.
In Column B is HireDate.
Column C - I has the heading of what game they deal (BJ,TCP,CRAPS,ect, ect.)
In Column C-I has "x" if they deal that particular game.
Column L-R has the same column heads (BJ,TCP,CRAPS, ect, ect.)

What I want:
If cell C3 has an "X" in the row (meaning if they deal that particular game
or not) If there is an "x" in c3 then copy a3 to L3.

Problem is that Dealers come and go (high turnover rate). If Cell A3 name
changes, and he doesn't deal BJ then there will be an empty cell in the
coresponding list of names (column L). I don't want to have any empty cells
in columns L-R.
I hope i have expained it properly. Thanks guys and gals.

Robb

Crowbar via OfficeKB.com

copy cell contents if "x" is present in cell.
 
Dim LastRow
LastRow = Sheet1.UsedRange.Row - 1 + _
Sheet1.UsedRange.Rows.Count

For x = 1 to lastrow

If sheet1.cells(x, 3).value = "X" then
range("L" & x).value = range("A" & x).value
End If
Next x


Jste this not tested it but it should do what you want



--
Message posted via
http://www.officekb.com


All times are GMT +1. The time now is 09:18 AM.

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