User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 427,222 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,253 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 465 | Replies: 2
Reply
Join Date: Jul 2008
Posts: 2
Reputation: jtomacelli is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jtomacelli jtomacelli is offline Offline
Newbie Poster

Help with Excel Macro ...Please

  #1  
Jul 16th, 2008
I need to copy the data from the top row of a worksheet to all those empty rows underneath it UNTILL you get to a row that has data…then start over and copy that new data into the empty rows….and so on…

I have the code that we've written so far attached and below is an example of the data (a row with info...then blank rows that need to be filled with the above info...)

I'm not so good at this, but if anyone has any suggestions, please let me know
THanks
Jen

16296 INV BALLESTER CONSULTI 4541 29-Jun-07


13518 INV BEST RESEARCH 4271 23-Apr-07




13963 INV BLAUW RESEARCH 4298 30-Apr-07


14250 INV BLAUW RESEARCH 4298 15-May-07



10889 INV BRAINJUICER BV 2270 25-Jan-07
Attached Files
File Type: txt vbcode.txt (1.1 KB, 3 views)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Posts: 78
Reputation: manoshailu is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 6
manoshailu's Avatar
manoshailu manoshailu is offline Offline
Junior Poster in Training

Re: Help with Excel Macro ...Please

  #2  
Jul 18th, 2008
hi,

Try below coding:

Sub fill2()
'
' fill2 Macro
'

'

   Declare the Variables
    Dim intRng As Integer 'Get the Range of rows from the user
    Dim strStart As String  'Assign the Starting Range
    Dim strEnd As String 'Assign the Ending Range
    Dim intI As Integer 'For Loop
    Dim strRange As String 'Concatenate the strStart and strEnd 
    Dim strVal As String 'Get the Value of the cell

    'Get the input from the use for no. of rows
    intRng = InputBox("Enter the No. of Rows?", "Fill the Blank")
    
     For Loop
    For i = 1 To intRng
        strStart = "A" & i Starting Range
        strEnd = "F" & i Ending Range
        strRange = strStart & ":" & strEnd Concatenation of strStart and strEnd
        strVal = Cells(i, 1)      'Value of the Cell
        If strVal <> "" Then      ' If the cell contain the values
            Range(strRange).Select     'Select the Row
            Selection.Copy      'Copy the row
        Else
           'The below process will be done until the cell is blank
            Range(strRange).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
        End If
    Next
End Sub

Have a nice Day

Shailaja



Originally Posted by jtomacelli View Post
I need to copy the data from the top row of a worksheet to all those empty rows underneath it UNTILL you get to a row that has data…then start over and copy that new data into the empty rows….and so on…

I have the code that we've written so far attached and below is an example of the data (a row with info...then blank rows that need to be filled with the above info...)

I'm not so good at this, but if anyone has any suggestions, please let me know
THanks
Jen

16296 INV BALLESTER CONSULTI 4541 29-Jun-07


13518 INV BEST RESEARCH 4271 23-Apr-07




13963 INV BLAUW RESEARCH 4298 30-Apr-07


14250 INV BLAUW RESEARCH 4298 15-May-07



10889 INV BRAINJUICER BV 2270 25-Jan-07
Last edited by Tekmaven : Jul 18th, 2008 at 5:36 am. Reason: Code tags
Reply With Quote  
Join Date: Apr 2007
Posts: 41
Reputation: vbCNEW is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 3
vbCNEW vbCNEW is offline Offline
Light Poster

Re: Help with Excel Macro ...Please

  #3  
Jul 19th, 2008
hey i could help you but i cant understand what u want.. post here a sample data and your expected data after running the macro.. then put even alittle explaination.. then ill send you your code.. tnx
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 11:25 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC