Excel Offset Printing Incorrectly

moviewoman

New Member
Joined
Nov 17, 2015
Messages
3
I have a UserForm that takes data from a Multicolumn Listbox and inputs the selected data to an Excel sheet. I have the sheet and row to input the data correct but can not get the column to print correctly. I have changed column values including: 0, 1, 2, 3. Using 0 it returns in column A, using 1 it returns in column E, and using 2 it returns in column F. I just can't figure out why it is doing this. Here is the code I am using:

Private Sub UpdatePart_Click()

elr = Me.ExistingList.Column(5) - 1

With Worksheets(Me.ExistingList.Column(0)).Select

If Me.ExistingList.Value = "" Then
MsgBox "Choose Shop Supply to Change", vbExclamation, "Change Part Error"
Me.ExistingList.SetFocus
Exit Sub
End If


If Me.NewOnHand.Value = "" And Me.NewLocation.Value = "" And Me.NewLocation2.Value = "" Then
MsgBox "Enter a Value to Change", vbExclamation, "Change Part Error"
Me.NewOnHand.SetFocus
Exit Sub
End If

If Me.NewOnHand.Value > "" Then
With Worksheets(Me.ExistingList.Column(0)).Range("A1")
.Offset(elr, 1).Value = Me.NewOnHand.Value
End With
Exit Sub
End If

If Me.NewLocation.Value > "" Then
With Worksheets(Me.ExistingList.Column(0)).Range("A1")
.Offset(elr, 2).Value = Me.NewLocation.Value
End With
Exit Sub
End If

LastUsed = Range(Me.ExistingList.Column(5) & ColumnCount).End(xlToLeft).Column
Do Until Range(Me.ExistingList.Column(5) & LastUsed).Value <> ""
LastUsed = LastUsed - 1
Loop
Range(Me.ExistingList.Column(5) & LastUsed).Select

If Me.NewLocation2.Value > "" Then
With Worksheets(Me.ExistingList.Column(0)).Range("A1")
.Offset(elr, LastUsed).Value = Me.NewLocation2.Value
End With
Exit Sub
End If

End With
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,214,981
Messages
6,122,566
Members
449,089
Latest member
Motoracer88

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