Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

declare variable so can be uased as

Status
Not open for further replies.

smiler44

Technical User
Sep 18, 2009
83
0
0
GB
is it possible to declare a variable so it can hold text or number?
I thought "dim variablename as variable" would work but it seems not?

thank you
smiler44
 
my customer orders all have varying number of pages, can be over 200 page or as little as 30. the macro is for the user to enter a word at the top of the screen that they wish to find in the 200 or so pages. the macro starts at the last page and works to page 1. if it finds a match it notes the page number, row number and they whole row of text that the word was found in. Once the macro has found 20 instances or gets to note 1 it allows the user to choose which instance they want to look at

If for example I have 200 pages, the user selects to look at an instance on page 100. I don't want to go to the last page and page backwards to page 100. All this I can do with strings.

Looking at the "index" of notes there are 14 notes per page. By going to the next page there will be another 14 rows of notes. The user can select any note to read.

I want to work out how many pages there are in total, 200 in this example. I may then need to minus 14 and see if the result is more, less or equal to 100. if more, then I need to go to the next page of 14 notes and again minus 14 again. is the result more, less, equal to 100 and so on. eventually I think I will end up with 96. at this point I will select a note. if this note is less then 100 I will page forward one page at a time to page 100. it is for this working out that I think I need to use an integer


smiler44
 
found out it is best not to declare a variable as integer but long.

I have now changed by variables from integers to long, this seems to have solved the problem
smiler44
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top