ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need data in cells on one row extracted to multiple rows (https://www.excelbanter.com/excel-programming/390011-re-need-data-cells-one-row-extracted-multiple-rows.html)

Jeff[_55_]

Need data in cells on one row extracted to multiple rows
 
On May 23, 11:38 am, Joel wrote:
Give more info on format of spreadsheet.
1)Which column has the date
2)Which columns need to be repeated on new rows besides date.
3) which columns have the sale catorgories.



" wrote:
I am very new to VBA, but I have quite a bit of experience in Excel.
I have data in multiple cells on one row of a spreadsheet that I need
to extract and place on multiple rows (in a new worksheet). My
situation is this: I get a "daily sales report" with one row for each
day. On each row are numbers from different sales categories. I need
to create an import file to get this info into the accounting
system...this requires me to take each of those categories and make a
separate row for each one but using the same date as the row from
which they were extracted. Does anyone know how I should approach
this? What function do I use? I just need a lead to help me get
started. Thanks.- Hide quoted text -


- Show quoted text -


One thing I failed to mention earlier is that I want this whole
operation to begin by selecting only the rows from the first worksheet
that fall between two dates - it needs to ask for those two dates.
Here's the code I found on a website I thought I would start with.
NOTE: I DID NOT WRITE THIS CODE, nor could I even if I wanted to (not
yet at least):

Sub Import_File()

' Purpose: (1) create new worksheet _
(2) copy data in one row (rows determined by date) _
(3) past data in multiple rows in correct columns _
(4) fill other columns with constant info _
(5) take user input (trans #) -- past that into
correct cells

' Ok, all of what is below, I copied from a website _
It's supposed to allow me to enter dates for it to look for.

Dim startDate As String, stopDate As String, startCel As Integer,
stopCel As Integer, dateRange As Range
On Error Resume Next
Do
startDate = InputBox("Please enter Start Date: Format(mm/dd/yy)",
"START DATE")
If startDate = "" Then End
Loop Until startDate = Format(startDate, "mm/dd/yy") _
Or startDate = Format(startDate, "m/d/yy")
Do
stopDate = InputBox("Please enter Stop Date: Format(mm/dd/yy)",
"STOP DATE")
If stopDate = "" Then End
Loop Until stopDate = Format(stopDate, "mm/dd/yy") _
Or stopDate = Format(stopDate, "m/d/yy")
startDate = Format(startDate, "mm/dd/yy")
stopDate = Format(stopDate, "mm/dd/yy")
startCel = Sheets(1).Columns(1).Find(startDate, LookIn:=xlValues,
lookat:=xlWhole).Row
stopCel = Sheets(1).Columns(1).Find(stopDate, LookIn:=xlValues,
lookat:=xlWhole).Row

End Sub



All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com