Code Error

shannonja

New Member
Joined
Oct 23, 2019
Messages
1
Could someone please help me out with this, im pretty green with coding, and the orange part is getting an error, thanks

Sub Empl_Load()
Dim EmpRow As Long
Dim EmpCol As Long
With Sheet1
If .Range("B5").Value = Empty Then
MsgBox "Please enter a valid Employee from the drop down list"
Exit Sub
End If
.Range("B1").Value = True 'Set Employee Load To True
EmpRow = .Range("B5").Value
For EmpCol = 1 To 28
.Range(Sheet2.Cells(1, EmpCol).Value).Value = Sheet2.Cells(EmpRow, EmpCol).Value
Next EmpCol
.Shapes("Group 67").Visible = msoFalse
.Shapes("Group 66").Visible = msoCTrue
.Range("B1").Value = False 'Set Employee Load To False
.Range("B6").Value = False 'Set New Employee To False
Show_EmplPic
End With
End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Code:
.Range(Sheet2.Cells(1, EmpCol).Value)

This part is wrong unless you have a range address in Sheet2.Cells(1, EmpCol), on what sheet do you want
Code:
Sheet2.Cells(EmpRow, EmpCol).Value
placed? and what is in
Code:
Sheet2.Cells(1, EmpCol).Value
?

There might be more questions depending what your answers to the 2 questions are.
 
Upvote 0

Forum statistics

Threads
1,224,743
Messages
6,180,692
Members
452,994
Latest member
Janick

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