+ Reply to Thread
Results 1 to 2 of 2

Declaring value type from a transfered variable

Hybrid View

Broobi Declaring value type from a... 09-09-2015, 03:04 PM
skywriter Re: Declaring value type from... 09-09-2015, 03:08 PM
  1. #1
    Registered User
    Join Date
    03-12-2014
    Location
    Windsor, UK
    MS-Off Ver
    Excel 2007
    Posts
    43

    Declaring value type from a transfered variable

    Hi All

    Im hoping this will be an easy one...

    I have a macro that picks up a variable value from a previous userform, which works great. but for some reason my bit of code that should find said variable value in a column, doesnt seem to recognise it... i have a feeling its because i need to somehow declare it as an integer (the variable value is a number) but i cant work out where or how i tell it this

    
    TicketNumber3 = MainForm.viewticks.Value
    
    varResult = Updateinput
    
    
        For Each Cll In Sheets("mi tickets").Range("B2:B" & Sheets("mi tickets").Range("B:B").SpecialCells(xlCellTypeLastCell).Row)
            
            If Cll = TicketNumber3 Then
                If VarType(varResult) = vbString Then
                        Cll.Offset(0, 18) = Cll.Offset(0, 18).Value2 & Chr(10) & Chr(10) & "My Data"
                        
                        varResult = Replace(varResult, Chr(13), "")
                        
                End If
            End If
            
        Next Cll
    TicketNumber, is the variable value from the UserForm "MainForm". I know it has remebered it as i tested it in a random cell... but can't work out why the Cll wont use it?

    i tried:

    If Cll = (CLng(TicketNumber3) Then
    but to no avail

    Any help would be greatly appreciated!

    Many thanks in advance, as always, for any help or suggestions

    Many thanks all!


  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Declaring value type from a transfered variable

    Try:
    VAL(TicketNumber3)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Declaring variable for object..
    By calvinle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-21-2014, 12:08 AM
  2. [SOLVED] Declaring and naming a variable
    By ExcelAteMyHomework in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-30-2012, 03:07 PM
  3. declaring a variable
    By squeekee35 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-06-2011, 03:36 PM
  4. Declaring A Variable in VBA
    By Bono1083 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2010, 04:09 PM
  5. Declaring the type of a bunch of variables
    By hoopz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2006, 07:19 PM
  6. Declaring Data Type of Array
    By tfischer@mad.scientist.com in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-07-2006, 02:00 AM
  7. [SOLVED] declaring public variable value
    By Damon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-24-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1