Relative Cut/Paste & Clear Contents

tape deck

Board Regular
Joined
Jan 17, 2003
Messages
51
AkutInv.xls
ABCDEFGHIJ
186MISCELLANEOUSFISH
187BLACKBASS-60#171,020137800301,800780
188SKATELN-44#00451,9800451,9801,980
189RAYRN-44#0000004,972
190MACKEREL50#000000154,432
191YELLOWEYEROCKFISH50#482,40000482,4002,400
192BLACKCODTRAWLBYCATCH-TOTES1722001722722
193IDIOTFISH50#0000004,200
194AKFLOUNDER-50#00000042,550
195PACIFICOCEANPERCH-50#000000151,400
196TOTALMISCELLANEOUSFISHPRODUCT664,142582,760001246,902363,436
341 (2)


Hi. This seems like it should be easy. Maybe I've just been at work to long today. :unsure:

I'm trying to write a macro that'll copy the contents of column J and paste them in column K. Problem is that the number of cells above and below will change from time to time as people insert lines. Regardless, what is in the J column between the MISCELLANEOUS and TOTAL MISCELLANEOUS FISH PRODUCT rows always needs to be pasted in the next cells over in column K.

I have many spreadsheets set up like this, but declaring set ranges(i.e. copy J187:J196, paste K187), but every time a row is inserted in the spreadsheet the macro needs to be revised.

FYI:
Column B is cases on hand (balance forward)forward. Column C is weight on hand(balance forward).
Column D is today's # of cases produced. Column E is today's # of pounds produced.
Column F is today's cases shipped. Column G is today's pounds shipped.
Column H is cases on hand. Column I is pounds on hand.
Column J is Fiscal YTD pounds produced. Column K is Fiscal YTD(balance forward).

This macro is run once every morning.

Thank you very much for any and all help.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
' SAMPLE 1
Sub CopyAndPaste()
BotRow = Range("J2").End(xlDown).Row
Range("J2:J" & BotRow).Copy
ActiveSheet.Paste Destination:=Range("K2")
Application.CutCopyMode = False
End Sub

' SAMPLE 2
Sub CopyValueDemo()
For Each c In Range("J:J").SpecialCells(xlCellTypeFormulas, 3)
c.Offset(0, 1).Value = c.Value
Next c
End Sub

' SAMPLE 3
Sub CopyAndPaste()
BotRow = Range("J2").End(xlDown).Row - 1
Range("J2:J" & BotRow).Copy
ActiveSheet.Paste Destination:=Range("K2")
Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,497
Messages
6,125,157
Members
449,208
Latest member
emmac

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