ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   help with EXCEL SCRIPT (https://www.excelbanter.com/excel-discussion-misc-queries/206985-help-excel-script.html)

nastech

help with EXCEL SCRIPT
 
hi, trying to get help on automating copy-paste of data columns. have 4
items to move:
if possible would like double guard: Cell: $DN$6="z", if use of button
to activate/initiate has a pop-up: "Are you Sure": Y/N
if possible: (automatic) adjust of column / cell: $DN$6 locations in
script .. ??, if other items are moved.

specifics on column letters, for (4) moves:
1 col: DU to DT
22 col (main, 21 col back up), COPY: EE - EY,
Paste-Special-Values to right 1 col: EF - EZ
double columns (10 sets of 2), COPY: FE - FV, Paste-Special-Values
to right 2 cols: FG - FX
double columns (1 set of 2), COPY: EC - ED, Paste-Special-Values
to: FE - FF

the following is a copy of the script currently in use. thanks.



Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Target.Row < 130 Then Exit Sub
'add "+" to blank spaces col A:
If Me.Cells(.Row, "A").Value = "." Then Exit Sub
If Not Intersect(Me.Range("a:a"), .Cells) Is Nothing Then
Application.EnableEvents = False
.Value = Replace(.Value, " ", "+")
Application.EnableEvents = True
End If
'make column changes:
If Not Intersect(Me.Range("CK:CO"), .Cells) Is Nothing Then
Application.EnableEvents = False
'Destination:
With Me.Cells(.Row, "CF")
.NumberFormat = "dd"
.Value = Now
End With
Application.EnableEvents = True
End If
'make column changes:
If Not Intersect(Me.Range("CW:CW"), .Cells) Is Nothing Then
Application.EnableEvents = False
'Destination
With Me.Cells(.Row, "CG")
.NumberFormat = "dd"
.Value = Now
End With
Application.EnableEvents = True
End If
End With
End Sub




All times are GMT +1. The time now is 11:32 PM.

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