Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copy value
On Nov 7, 11:38*am, Don Guillett wrote:
Should do it. You don't need to put anything in the column to the left. Excel will do it. Sub copynumbersif() Dim mc As Long Dim i As Long mc = 2 'if column B For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row If Cells(i - 1, mc) = Cells(i, mc) Then Cells(i - 1, mc - 1) = Cells(i, mc) Cells(i, mc - 1) = Cells(i, mc) End If Next i End Sub On Nov 7, 12:21*pm, gary wrote: If B4 = B3 and A3 contains a value, how can I copy the value in A3 down to A4? Here is my spreadsheet: * * * * * * *A * * * * * * B * 1 * * * * * * * * * *0082766 * 2 * * * * * * * * * *0082767 * 3 * *0082768 *0082768 * 4 * * * * * * * * * *0082768 * 5 * * * * * * * * * *0082768 * 6 * * * * * * * * * *0082768 * 7 * * * * * * * * * *0082768 * 8 * * * * * * * * * *0104361 * 9 * * * * * * * * * *0104365 10 * * * * * * * * * *0104367 11 * * * * * * * * * *0104368 12 * * * * * * * * * *0104370 13 * 0104409 * 0104409 14 * * * * * * * * * *0104409 ========= This is the result I'm looking for: * * * * * *A * * * * * * B * 1 * * * * * * * * * *0082766 * 2 * * * * * * * * * *0082767 * 3 * *0082768 *0082768 * 4 * *0082768 *0082768 * 5 * *0082768 *0082768 * 6 * *0082768 *0082768 * 7 * *0082768 *0082768 * 8 * * * * * * * * * *0104361 * 9 * * * * * * * * * *0104365 10 * * * * * * * * * *0104367 11 * * * * * * * * * *0104368 12 * * * * * * * * * *0104370 13 * 0104409 * 0104409 14 * 0104409 * 0104409- Hide quoted text - - Show quoted text - That doesn't work. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Copy value
What is "that doesn't work"? Not very helpful IMO.
I run Don's maacro on your before data and get exactly what you want for your after data. Either your sample data is incorrect or you want something different than what you asked for. Gord On Mon, 7 Nov 2011 11:49:22 -0800 (PST), gary wrote: On Nov 7, 11:38*am, Don Guillett wrote: Should do it. You don't need to put anything in the column to the left. Excel will do it. Sub copynumbersif() Dim mc As Long Dim i As Long mc = 2 'if column B For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row If Cells(i - 1, mc) = Cells(i, mc) Then Cells(i - 1, mc - 1) = Cells(i, mc) Cells(i, mc - 1) = Cells(i, mc) End If Next i End Sub On Nov 7, 12:21*pm, gary wrote: If B4 = B3 and A3 contains a value, how can I copy the value in A3 down to A4? Here is my spreadsheet: * * * * * * *A * * * * * * B * 1 * * * * * * * * * *0082766 * 2 * * * * * * * * * *0082767 * 3 * *0082768 *0082768 * 4 * * * * * * * * * *0082768 * 5 * * * * * * * * * *0082768 * 6 * * * * * * * * * *0082768 * 7 * * * * * * * * * *0082768 * 8 * * * * * * * * * *0104361 * 9 * * * * * * * * * *0104365 10 * * * * * * * * * *0104367 11 * * * * * * * * * *0104368 12 * * * * * * * * * *0104370 13 * 0104409 * 0104409 14 * * * * * * * * * *0104409 ========= This is the result I'm looking for: * * * * * *A * * * * * * B * 1 * * * * * * * * * *0082766 * 2 * * * * * * * * * *0082767 * 3 * *0082768 *0082768 * 4 * *0082768 *0082768 * 5 * *0082768 *0082768 * 6 * *0082768 *0082768 * 7 * *0082768 *0082768 * 8 * * * * * * * * * *0104361 * 9 * * * * * * * * * *0104365 10 * * * * * * * * * *0104367 11 * * * * * * * * * *0104368 12 * * * * * * * * * *0104370 13 * 0104409 * 0104409 14 * 0104409 * 0104409- Hide quoted text - - Show quoted text - That doesn't work. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I copy big ranges of cells without drag or copy/paste? | Excel Discussion (Misc queries) | |||
Copy and paste versus copy and insert copied cells | New Users to Excel | |||
I copy a formula and the results copy from the original cell | Excel Discussion (Misc queries) | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
EXCEL FILE a copy/a copy/a copy ....filename | New Users to Excel |