View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
reena[_3_] reena[_3_] is offline
external usenet poster
 
Posts: 1
Default Is this really possible?


Hi,

I have made some changes in the above given code. Now this is workin
fine. But there are two things I want in this.
1. Currently this is copying only one column in the Output tab. I wan
to copy all the columns which are specified in the SetUp tab
2. Creating a new workbook for output.

How to do this? I have given the modified code for referance.

Dim sh As Worksheet
Dim shi As Worksheet
Dim sho As Worksheet
Dim setrng As Range
Dim cell As Range
Dim i As Long
Set sh = Worksheets("SetUp")
Set shi = Workbooks("Input.xls").Worksheets(1)
Set sho = Worksheets("Output")
Set setrng = sh.Range("A1").CurrentRegion.Rows(1).Cells
i = 1
For Each cell In setrng
shi.Columns(cell.Value).Copy Destination:=sho.Columns(i)
'sho.Columns(i).ColumnWidth = cell.Offset(1, 0)
If Not IsEmpty(cell.Offset(2, 0)) Then
sho.Cells(1, i).Value = cell.Offset(2, 0)
End If
If Not IsEmpty(cell.Offset(3, 0)) Then
sho.Cells(1, i).Font.Size = cell.Offset(3, 0).Value
End If
i = i + 1
Nex

--
reen
-----------------------------------------------------------------------
reena's Profile: http://www.excelforum.com/member.php...fo&userid=3044
View this thread: http://www.excelforum.com/showthread.php?threadid=50102