Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 06-08-2009, 01:30 PM
bdb1974 bdb1974 is offline
Valued Forum Contributor
 
Join Date: 10 Dec 2008
Location: Austin
Posts: 413
bdb1974 is becoming part of the community
Transfer Values Based On Condition & Insert Date

Please Register to Remove these Ads

Any help to fix my code is appreciated.
So far it's not doing what I need it to.
For the item numbers in column A, I have a values representing quanities in columns D,E,G, and L. D&E being the most recent qty value.
If the value in column E changes and is not equal to value in G, than these values for the item number in A, will be copied and replacing the values in G. Likewise, G will be transfered to L.

For each change in value in G, I want to have the current date be put into column H for the corresponding row. For each transfer from G to L.
The date in column H will be copied to column M for the corresponding row.

I've attached an example problem.

The code so far is as follows:

Code:
Sub LoadSub()

'Sheets("Inventory_YARD").Activate

'Working_Yard
'LastRow = Cells(Rows.Count, 1).End(xlUp).Row
'For i = 1 To LastRow
 ' For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
    'Application.StatusBar = "Transferring Inventory Counts & Updating Yard Count" & i & " of " & LastRow
    'If Cells(i, "E") - Cells(i, "G") <> 0 Then
  'TO COPY INVENTORY COUNTS OVER TO NEXT COLUMN AND TO UPDATE YARD COUNTS
 ' Set findit = OutPL.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
'If Not findit Is Nothing Then
   ' Set findit = Sheets("Inventory_YARD").Range("A:A").Find(what:=Cells(i, 1).Value)
'Next i
  
'Set OutPL = Sheets("Inventory_YARD")
 'Sheets("Inventory_YARD").Activate

'For J = OutPL.Cells(i, 1).End(xlUp).find:Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)

'LastRow = Cells(Rows.Count, 1).End(xlUp).Row
  'For i = 1 To LastRow
  '  Application.StatusBar = "Transferring Inventory Counts & Updating Yard Count" & i & " of " & LastRow
    
   'Cells(i, "O").Value = findit.Offset(0, 24).Value
    '  Cells(i, "Q").Value = findit.Offset(0, 25).Value
  '    Set findit = Sheets("Inventory_YARD").Range("A:A").Find(what:=Cells(i, 1).Value)
  '    If Not findit Is Nothing Then
 ' If findit.Offset(i, 15) - findit.Offset(i, 11) <> 0 Then
 '     findit.Offset(i, 15).Value = findit.Offset(i, 11).Value
  '     findit.Offset(i, "16").Value = findit.Offset(i, "12").Value
  '    End If
 'If Cells(i, "G") - Cells(i, "L") <> 0 Then
 'If findit.Offset(i, "20") - findit.Offset(i, "18") <> 0 Then
 '      findit.Offset(i, 11).Value = findit.Offset(i, 6).Value
 '      Cells(i, "M").Value = findit.Offset(i, 7).Value
 '     End If
 'If findit.Offset(i, "20") - findit.Offset(i, "18") <> 0 Then
 '      Cells(i, "E").Value = findit.Offset(i, "6").Value
 '      Cells(i, "F").Value = OutPL.Format(Now, "mm/dd/yyyy")
  '    End If
  '    End If
'Next i
'End If
'End If
'Next i

a = 1
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 8 To LastRow
Set Findit = Sheets("Inventory_YARD").Range("A:A").Find(what:=Cells(i, 1).Value)
    If (Cells(i, 5).Value <> Cells(i, 7).Value) Then
'Set J=OutPL.Cells(i, 1).End(xlUp).find:Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Set OutPL = Sheets("Inventory_YARD")
        a = a + 1
        Findit.Cells(i, 5).Copy
        Findit.Cells(a, 7).PasteSpecial Paste:=xlValues
        'Cells(a, G).Value = OutPL.Format(Now, "mm/dd/yyyy")
        'Cells(a, 7) = DATE:"MM,DD,YYYY")
    End If
Next i
 Application.StatusBar = False
MsgBox "Done"
End Sub
I've commented out a lot of lines, that I've tried to use to get something working for me.

To test, just put any value you want into columns E. Again, if the value is
different than the value appearing in column G, than the value in E should get transferred to G. Therefore, the sequece of events will be :
G to L
then
E to G

Again, Any help is appriciated.

Thanks,

BDB
Attached Files
File Type: xls 0a4_Test_Working_GUS_YARD_example.xls (53.5 KB, 3 views)
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump