+ Reply to Thread
Results 1 to 3 of 3

Need to print values horizontally and them certain cells away.

Hybrid View

  1. #1
    Registered User
    Join Date
    09-21-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    28

    Need to print values horizontally and them certain cells away.

    I have this formula which prints numbers from 1-whatever user enters. I need help so when it prints it prints horizontally(at the mo, it does it vertically) , also I have used the step function because i want it to print the next value x many cells away form the previous(the number of cells away will be fixed horizontally, but when i run the code, it prints every other value within the range.

    E.g. I want it to print from value 1-5 with the step function it will print 1,3,5. I need it to print 1,2,3,4,5 a cetain amount of cells away.

    
    Sub Add_Site_Summary()
    
    Dim NumToFill As Long
    Dim CellCount As Long
    
    NumToFill = InputBox("How many sites all together")
            
            For CellCount = 1 To NumToFill Step 2
            Range("B5").Offset(CellCount - 1, 0) = CellCount + 0
    Next CellCount
    Any help will be much appreciated

    Thanks

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Need to print values horizontally and them certain cells away.

    I don't really follow what you want, an example would be good. Maybe:

    Sub Add_Site_Summary()
    
    Dim NumToFill As Long
    Dim CellCount As Long
    
    NumToFill = InputBox("How many sites all together")
            
            For CellCount = 1 To NumToFill
            Range("B5").Offset(0, cellcount-1) = CellCount
    Next CellCount

  3. #3
    Registered User
    Join Date
    09-21-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Need to print values horizontally and them certain cells away.

    Hi Kyle 123,

    Yh that seems to print it horizontally.

    As for the certain cells away, I would like the first value to be printed in B5, the second valuse to be printed in I5, third value to be printed in Q5, the values are 8 columns away from each other.

    Dos that make more sense? :S

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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