Help Needed Please

Steveo59

Board Regular
Joined
Oct 19, 2007
Messages
204
The following code works fine but i would like to make an adjustment. This may be simple to some but i can not grasp how. Data is in F5:F50. When F5:F50 is refreshed this data is placed in column Y. However i would the next refresh of F5:F50 to be placed in column Z then AA and so on.

I hope this makes sense and any help would be much appreciated. Thank you.


Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
 
   If Target.Columns.Count <> 16 Then Exit Sub
   
   
Range("F5:F50").Copy
        Range("Y5").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
        
         Application.EnableEvents = False
        Range("F5:F50").Copy
        Range("Y5").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
        Application.EnableEvents = True
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Maybe something like this:

<font face=Calibri>    Application.EnableEvents = <SPAN style="color:#00007F">False</SPAN><br>        Range("F5:F50").Copy<br>        <SPAN style="color:#00007F">If</SPAN> LenB(Range("Y5")) = 0 <SPAN style="color:#00007F">Then</SPAN><br>            Range("Y5").PasteSpecial Paste:=xlPasteValues<br>        <SPAN style="color:#00007F">Else</SPAN><br>            Cells(5, Columns.Count).End(xlToLeft).Offset(, 1).PasteSpecial Paste:=xlPasteValues<br>        <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br>    Application.EnableEvents = <SPAN style="color:#00007F">True</SPAN></FONT>

HTH,
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

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