Updated specific locations to be searchable, take a look at Las Vegas as an example.

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

6
Transferring value from one sheet to another and getting error, why?
Post Body

Hey all, I'm a fairly new VBA user so be gentle please =)

I wrote a bit of code earlier that works just fine, and basically takes cell values from one sheet and transfers them into the last blank row of a table on another shet.

I tried to recreate this with slightly different sources but its not working. If I step through the code everything works up until I get to the part where the variables with values stored in them are trying to be assigned to cells in the other sheet.

The code is as follows:

Sub AddAthleteTestResults()

Application.ScreenUpdating = False

TestDate = Sheet1.Range("G5")

AthleteID = Sheet1.Range("G6")

Name = Sheet1.Range("G7")

Test1 = Sheet1.Range("G8")

Test2 = Sheet1.Range("G9")

Test3 = Sheet1.Range("G10")

Test4 = Sheet1.Range("G11")

Test5 = Sheet1.Range("G12")

Test6 = Sheet1.Range("G13")

Test7 = Sheet1.Range("G14")

Test8 = Sheet1.Range("G15")

Test9 = Sheet1.Range("G16")

Test10 = Sheet1.Range("G17")

If Date = "" Then

MsgBox ("Please Enter When the Test was Completed")

Exit Sub

End If

If AthleteID = "" Then

MsgBox ("Please Enter the Athlete's ID")

Exit Sub

End If

If Name = "" Then

MsgBox ("Please Enter an Athlete Name")

Exit Sub

End If

If Test1 = "" Then

MsgBox ("Please Enter Results from At Least One Test")

Exit Sub

End If

lrow_tests = Sheet3.Cells(Rows.Count, 2).End(xlUp).Rows 1

Sheet3.Range("B" & lrow_tests) = TestDate (Error starts here, but I can't figure out why)

Sheet3.Range("C" & lrow_tests) = AthleteID

Sheet3.Range("D" & lrow_tests) = Name

Sheet3.Range("E" & lrow_tests) = Test1

Sheet3.Range("F" & lrow_tests) = Test2

Sheet3.Range("G" & lrow_tests) = Test3

Sheet3.Range("H" & lrow_tests) = Test4

Sheet3.Range("I" & lrow_tests) = Test5

Sheet3.Range("J" & lrow_tests) = Test6

Sheet3.Range("K" & lrow_tests) = Test7

Sheet3.Range("L" & lrow_tests) = Test8

Sheet3.Range("M" & lrow_tests) = Test9

Sheet3.Range("N" & lrow_tests) = Test10

Sheet3.Cells.EntireColumn.AutoFit

Sheet1.Range("G5:G14").clearcontents

MsgBox ("Testing Results Have Been Recorded")

Application.ScreenUpdating = True

End Sub

Any help is appreciated.

P.S. I know this probably isn't the most efficient code, but id still like to learn what I did wrong.

Author
Account Strength
90%
Account Age
5 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,742
Link Karma
937
Comment Karma
805
Profile updated: 21 hours ago
Posts updated: 4 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago