+ Reply to Thread
Results 1 to 6 of 6

vba to fill header value to apply to below cells of nonblank

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-21-2011
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2007,2010,2016
    Posts
    695

    vba to fill header value to apply to below cells of nonblank

    Dear experts

    good morning

    I have sheet called FILLDATES contains in column headings range(d2:BE2) some dates i want fill the dates till end of text value in column(C:C) macro apply to same procedure to every column heading to fill date to end cell...
    please find the attachment you may understand better than what i describe here i inserted outlike file which is i am looking for output


    thanks to all
    Attached Files Attached Files

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: vba to fill header value to apply to below cells of nonblank

    How about this,

    Sub dave()
      Dim a, c As Long, r As Long
      Dim x()
      Dim i As Long, j As Long
         
         With Sheets("FILLDATES")
            a = .Range("C2").CurrentRegion
            r = UBound(a): c = .Range("C2").CurrentRegion.Columns.Count
         End With
            ReDim x(1 To r, 1 To c)
              For i = 1 To c
                 For j = 1 To r
                   If i = 1 Then
                      x(j, i) = a(j, i)
                   ElseIf a(j, i) <> "" Then
                      x(j, i) = a(1, i)
                   Else
                      x(j, i) = a(j, i)
                   End If
                 Next j
              Next i
         With Sheets("OUPUTLIKE")
           .Cells.Delete: .Cells(3, 1).Resize(r, c).Value = x
           .Rows(3).Font.Bold = 1: .Cells(4, 2).Resize(r - 1, c - 1).Interior.Color = vbYellow
           .Columns(1).Resize(, c).AutoFit
         End With
    End Sub
    Attached Files Attached Files
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Forum Contributor
    Join Date
    07-21-2011
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2007,2010,2016
    Posts
    695

    Re: vba to fill header value to apply to below cells of nonblank

    Wow NIce Dude !!! Works Fine

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: vba to fill header value to apply to below cells of nonblank

    No problem, remember to say thanks.

  5. #5
    Forum Contributor
    Join Date
    07-21-2011
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2007,2010,2016
    Posts
    695

    Re: vba to fill header value to apply to below cells of nonblank

    Thanks alot

  6. #6
    Forum Contributor
    Join Date
    07-21-2011
    Location
    Bangalore,India
    MS-Off Ver
    Excel 2007,2010,2016
    Posts
    695

    Re: vba to fill header value to apply to below cells of nonblank

    dude can you help me out on this threat? this is my old thread
    http://www.excelforum.com/excel-prog...36#post3293436

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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