LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using created variant value to reference to a variant within my code

High everyone,

Love the site, and finally I have question to post!

I wish to make my code more efficient by cycling through a smaller
piece of code as follows:

Sub test()

Dim var As Variant
Dim No As Single
Dim Head1 As String

Head1 = "Test Header 1"

No = 1
While No < 2
var = ("Head" & No)
Range("A1").Offset(0, No).Value = var
No = No + 1
Wend

End Sub

The issue I am getting is the Var is inputting "Head1" instead of
"Test Header 1" into my worksheet.

If anyone can help I'd bre greatly apreciative.

Thanks
Tim
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variant CV323 Excel Programming 4 February 16th 07 09:57 PM
Using found variant within code Ron Dean[_2_] Excel Programming 2 September 15th 06 12:45 PM
is a variant an object James Cornthwaite Excel Programming 4 June 9th 06 11:49 PM
Variant owl527[_5_] Excel Programming 2 October 14th 05 09:37 PM
using find with variant? Don S Excel Programming 4 August 16th 05 04:52 PM


All times are GMT +1. The time now is 11:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"