#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default copy range

Hello everybody, I have a problem:
In my Sheet1 I have column A, D, G, J, M, P, S and V with values I need to
copy to Sheet2. The values are only the ones that in the second column to
the right have an * (so for A - C and so on).
There is a format I must follow (val=value): CellA headervalOZ/valOZ.T and
so on. I.E. PMC12345OZ/23457OZ.T2 (T=nr of values on that line). The max
amount of values per line is 5. If there are more than 5 value in a column
then a new alinea must be started. If there are less values then the values
in the new line must begin in a new row. I am not sure that what I wrote
makes any sense to you... but I surely hope so (it is all oh so clear in my
mind... lol)

thanks in advance for any help


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy range


Your instruction are a little vague. I took some guesses what you
wanted. Try this code. I can make somje simple changes if it is not
exactly correct



VBA Code:
--------------------


Sub MoveData()

NewRow = 1

With Sheets("Sheet1")
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
For RowCount = 1 To LastRow
NewCol = 2
AsteriskCount = 0
Header = .Range("A" & RowCount)
For ColIndex = 0 To 7
ColNumber = 3 * (ColIndex + 1)
Asterisk = .Cells(RowCount, ColIndex).Offset(0, 2)
Data = .Cells(RowCount, ColIndex).Offset(0, 2)
With Sheets("sheet2")
If Asterisk = "*" Then
AsteriskCount = AsteriskCount + 1
If AsteriskCount = 6 Then
NewCol = 2
AsteriskCount = 0
'total amounts on the line
Set SumRange = .Range("B" & NewRow & ":F" & NewRow)
Total = WorksheetFunction.Sum(SumRange)
.Range("A" & NewRow) = Header & "OZ/" & Total & "OZ.5"
NewRow = NewRow + 1
End If
.Cells(NewRow, NewCol) = Data
NewCol = NewCol + 1
End If
End With
Next ColIndex
If AsteriskCount 0 Then
Set SumRange = .Range("B" & NewRow & ":F" & NewRow)
Total = WorksheetFunction.Sum(SumRange)
.Range("A" & NewRow) = Header & "OZ/" & Total & "OZ." & _
AsteriskCount
NewRow = NewRow + 1
End If
Next RowCount
End With


End Sub

--------------------


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=200093

http://www.thecodecage.com/forumz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default copy range

I sent OP file using this.

Sub SAS_DoTelexSheet()
Application.ScreenUpdating = False
Sheets("telex").Columns(1).ClearContents
SAS_SortSCM_AllColumns'called to sort
With Sheets("SCM")
On Error Resume Next 'if no entries
For i = 1 To .Cells(1, .Columns.Count).End(xlToLeft).Column Step 3
clr = .Cells(.Rows.Count, i + 2).End(xlUp).Row
'MsgBox clr
r = 2
dlr = Sheets("Telex").Cells(Rows.Count, 1).End(xlUp).Row + 1
For j = 1 To Int(clr / 5) + 1 'MsgBox j
ms = ""
'MsgBox j
tc = 0
For k = 0 To 4
If .Cells(r + k, i + 2) = "*" Then
ms = ms & .Cells(r + k + 0, i) & "OZ/"
tc = tc + 1
End If
Next k
r = r + 5
'MsgBox tc
'MsgBox "." & Cells(1, i) & " " & Left(ms, Len(ms) - 1)
Sheets("Telex").Cells(dlr, 1) = "." & .Cells(1, i) & " " & Left(ms,
Len(ms) - 1) & ".T" & tc
Sheets("Telex").Cells(1, 1) = "Telex"
dlr = dlr + 1
Next j
Next i
End With
Application.ScreenUpdating = True
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mauro" wrote in message
. ..
Hello everybody, I have a problem:
In my Sheet1 I have column A, D, G, J, M, P, S and V with values I need to
copy to Sheet2. The values are only the ones that in the second column to
the right have an * (so for A - C and so on).
There is a format I must follow (val=value): CellA headervalOZ/valOZ.T and
so on. I.E. PMC12345OZ/23457OZ.T2 (T=nr of values on that line). The max
amount of values per line is 5. If there are more than 5 value in a column
then a new alinea must be started. If there are less values then the
values
in the new line must begin in a new row. I am not sure that what I wrote
makes any sense to you... but I surely hope so (it is all oh so clear in
my
mind... lol)

thanks in advance for any help



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
RANGE EXCEL copy cell that meets criteria in a range confused Excel Worksheet Functions 3 March 27th 08 01:41 PM
copy formulas from a contiguous range to a safe place and copy them back later Lucas Budlong Excel Programming 2 February 22nd 06 08:26 PM
Create/copy combo boxes in one range if condition is met in a different range LB[_4_] Excel Programming 4 September 30th 05 12:21 AM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM
Range COPY function - how to copy VALUES and not formulas James Cooke Excel Programming 1 August 21st 03 07:04 PM


All times are GMT +1. The time now is 07:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"