422,757 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,757 IT Pros & Developers. It's quick & easy.

trying to use an i subscript

100+
P: 416
I'm trying to convert the following statement to use an I subscript. I goes from 1 to 18.
Expand|Select|Wrap|Line Numbers
  1. TTime1 = Round((Time1 + (Misses1) * mtime) + ((Penelties1) * Ptime) + ((MSafety1) * MStime) - Bonus1,2)
In using the following
Expand|Select|Wrap|Line Numbers
  1. me("ttime" & I) = round((("Time" & I) + ((("Misses" & I)) * mtime) + ((("Penelties" & I)) * ptime) + ((("MSafety" & I)) * mstime) - ("Bonus" & I), 2)
I get no errors until I run the code and them I getting a type mismatch on the Me("ttime" & I) and I can't figure out if there is a way to do this.
Oct 6 '17 #1
Share this Question
Share on Google+
6 Replies


NeoPa
Expert Mod 15k+
P: 30,741
Have you typed this out instead of COPYing it in Tom. The message doesn't match the code, which uses an asterisk (*) and not the ampersand (&).
Oct 6 '17 #2

100+
P: 416
Yes I did type it in I tried to copy but wouldn't, it should be the &
Oct 6 '17 #3

100+
P: 416
ok I did get this to work. I ended up using the file name instead of the me( I added the file name here's the code that worked.
Expand|Select|Wrap|Line Numbers
  1. rsset.Edit
  2. rsset("ttime" & i) = Round(rsset("Time" & i) + ((rsset("misses" & i)) * mtime) + ((rsset("Penelties" & i)) * ptime) + ((rsset("MSafety" & i)) * MSTime) - rsset("Bonus" & i), 2)
  3. rsset.Update
  4.  
Oct 6 '17 #4

NeoPa
Expert Mod 15k+
P: 30,741
I'm glad you got it to work Tom, but totally intrigued by the idea that the copy wouldn't work. It's so important a concept when using forums that I shudder to think people can post questions without the ability to COPY and PASTE. I've been involved in many threads where that's not been used and the amount of time wasted is barely believable. That's both posters' and experts' time so nobody wins.
Oct 6 '17 #5

100+
P: 416
What's funny is I did a copy and paste into a word document and that worked from my code, then did a copy and paste from the word document and it worked. Don't know why it wouldn't work from my code.
Oct 7 '17 #6

NeoPa
Expert Mod 15k+
P: 30,741
That's a different question Tom, but I'll give you that as a freebie - The code window uses UNICODE and can play badly with some other apps. Copying it via a text editor is the most reliable way to get that done. Skype has a similar problem dealing with text copied across from the VBA window.
Oct 7 '17 #7

Post your reply

Sign in to post your reply or Sign up for a free account.