Can anyone help me please

Status
Not open for further replies.

sdc1234

Board Regular
Joined
Mar 17, 2011
Messages
122
OK, try this, Paste this into a module, and run it;
Code:
Sub MoveDate()
    
    Select Case Range("AI3").Value
    Case Is = ""
    Range("Z3:AA3").Select
    Selection.Cut
    Range("AI3").Select
    ActiveSheet.Paste
    
    Case Else
    
    Range("AI3").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Copy
    Range("AK3").Select
    ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
        IconFileName:=False
        
    Range("Z3:AA3").Select
    Selection.Cut
    Range("AI3").Select
    ActiveSheet.Paste
    End Select
End Sub
How can I get this code to autorun as soon as I open the worksheet please help I know it is something I am just not sure what the code is
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Change it to this:
Code:
Sub Auto_Open()
 
    Select Case Range("AI3").Value
    Case Is = ""
    Range("Z3:AA3").Select
    Selection.Cut
    Range("AI3").Select
    ActiveSheet.Paste
 
    Case Else
 
    Range("AI3").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Copy
    Range("AK3").Select
    ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
        IconFileName:=False
 
    Range("Z3:AA3").Select
    Selection.Cut
    Range("AI3").Select
    ActiveSheet.Paste
    End Select
End Sub
 
Upvote 0
sdc1234, when you post the same question in multiple threads, you're the only one that sees all the responses, and no one else knows that it's been answered in a duplicate post.
 
Upvote 0
sdc1234, when you post the same question in multiple threads, you're the only one that sees all the responses, and no one else knows that it's been answered in a duplicate post.
sorry bout that

<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
Change it to this:
Code:
Sub Auto_Open()
 
    Select Case Range("AI3").Value
    Case Is = ""
    Range("Z3:AA3").Select
    Selection.Cut
    Range("AI3").Select
    ActiveSheet.Paste
 
    Case Else
 
    Range("AI3").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Copy
    Range("AK3").Select
    ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
        IconFileName:=False
 
    Range("Z3:AA3").Select
    Selection.Cut
    Range("AI3").Select
    ActiveSheet.Paste
    End Select
End Sub

not generating what I need I dont understand

<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
sdc, have a look at your original post, I have offered a solution in that thread.


Colin
 
Upvote 0
sdc, have a look at your original post, I have offered a solution in that thread.


Colin
Private Sub Workbook_Open()

Sub MoveDate()

Select Case Range("AI3").Value
Case Is = ""
Range("Z3:AA3").Select
Selection.Cut
Range("AI3").Select
ActiveSheet.Paste

Case Else

Range("AI3").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("AK3").Select
ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
IconFileName:=False

Range("Z3:AA3").Select
Selection.Cut
Range("AI3").Select
ActiveSheet.Paste
End Select
End Sub

I get an error of expected end sub after I run the code I need this to run w/o error messages. I really do appreciate this

sdc
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
Remove the line highlighted in RED. You can't have two Sub's in a Workbook_Open event.

Rich (BB code):
Private Sub Workbook_Open()
 
Sub MoveDate()
 
Select Case Range("AI3").Value
Case Is = ""
Range("Z3:AA3").Select
.......
.........
 
Upvote 0
sdc, have a look at your original post, I have offered a solution in that thread.


Colin
thank u man appreciate it
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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