can anybody help me figure this out

sdc1234

Board Regular
Joined
Mar 17, 2011
Messages
122
<!-- google_ad_section_start -->can anybody help me figure this out<!-- google_ad_section_end --> <!-- google_ad_section_start -->I am making a report to show about 2000 employees. I have a formula but it only works for 1 as well as it only pushes 1 entry then i have to restart the macro, I know there is an easy way to do this but I have been working on this for days and am all out of ideas, what I am trying to do is have a code that pushes or even saves previous job titles from different employees I have the history section and date section in AI through AZ, I have the current Job title and Date in Z and AA, I want to be able to do this without coping and pasting and I want the formula to start working as soon as I open the worksheet... Is there an easier way to do what I want to do or do I need to revamp the formula for about 2000 employees... Please help!!! here is the formula I have in "this workbook":
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:=12, Link:=1, DisplayAsIcon:=False, _
IconFileName:=False

Range("Z3:AA3").Select
Selection.Cut
Range("AI3").Select
ActiveSheet.Paste
End Select
End Sub
confused.gif
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Loop through all rows in col "AI" starting at row 3
Code:
Sub MoveDate()
    Dim LR As Long
    For LR = 3 To Cells(Rows.Count, "AI").End(xlUp).Row 'lastrow
        Select Case Range("AI" & LR).Value
            Case Is = ""
                Range("Z" & LR & ":AA" & LR).Select
                Selection.Cut
                Range("AI" & LR).Select
                ActiveSheet.Paste
            Case Else
                Range("AI" & LR).Select
                Range(Selection, Selection.End(xlToRight)).Select
                Selection.Copy
                Range("AK" & LR).Select
                ActiveSheet.PasteSpecial Format:=12, Link:=1, DisplayAsIcon:=False, _
                IconFileName:=False
                
                Range("Z" & LR & ":AA" & LR).Select
                Selection.Cut
                Range("AI" & LR).Select
                ActiveSheet.Paste
        End Select
    Next LR
End Sub
 
Upvote 0
that code did not work is there something else I am missing

please advise
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
it works on the first row but I have 2000 rows, also I want it to run without me having to go to the VB page and hit run

please advise
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
that code did not work <input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">

And by that you mean...
Did it do anything?
Errors?
 
Upvote 0
no errors the cells are not moving to where I need them to move I have to go to the vb editor to run the script, I am trying not to

please advise
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
might there be an easier way to do what I am trying to accomplish???
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
Post sheet samples with headers.
1. What you start with
2. Results desired

Selecting the cells is not needed and will slow you down.
 
Upvote 0
sheet1: Z Job Title AA Date

row 3 Bagger 1/1/11


As I keep entering Job titles it pushes z, AA over to ....next post
<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Upvote 0
Job History
AI AJ
Bagger 1/1/11

Now lets say I enter A NEW Job title for that Same person
Job History
Z AA AI AJ AK AL
Job title Date Cashier 1/2/11 Bagger /1/1/11
Cashier 1/2/11


I need to accomplish this for about 2000 employees Row3-2500

I hope this helps
thx

<input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden"><input id="gwProxy" type="hidden"><!--Session data--><input *******="jsCall();" id="jsProxy" type="hidden">
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,572
Members
452,927
Latest member
whitfieldcraig

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