Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Enter Range value and get report

Hi All,

I hv a excel file with above 203 rows, and 54 columns, It is required
to view these perodically and generate report. I hv tried to make a
userform with two text boxes where user can enter the range row wise
only (e.g A1 and A53), after entering and clicking the command button
the data of this particular row range will be copied and pasted as
transposed in sheet 2 after which the user can print this sheet. Im
not too worried about the formats or print view stuff, just like to
make this work, I'll appreciate if anyone can help...

I tried the following code but getting errors,

Private Sub CommandButton1_Click()
'
'
Sheets("Sheet1").Select
Range("ActiveCell.Value = Cell_txt_1.Value:ActiveCell.Value =
Cell_txt_2.Value").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True



End Sub


Regards

OK

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Enter Range value and get report

How about this for a basis:

Private Sub CommandButton1_Click()

Dim Cell_txt_1 As String
Dim Cell_txt_2 As String

Cell_txt_1 = "A1" ' for testing ... needs to come from TextBox
Cell_txt_2 = "A25" ' for testing ... needs to come from TextBox

With Sheets("Sheet1")
.Range(Cell_txt_1 & ":" & Cell_txt_2).Copy
With Sheets("Sheet2")
.Range("A1").PasteSpecial Paste:=xlPasteAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=True
End With
End With

Application.CutCopyMode = False

End Sub

Regards

Trevor


"OK" wrote in message
ups.com...
Hi All,

I hv a excel file with above 203 rows, and 54 columns, It is required
to view these perodically and generate report. I hv tried to make a
userform with two text boxes where user can enter the range row wise
only (e.g A1 and A53), after entering and clicking the command button
the data of this particular row range will be copied and pasted as
transposed in sheet 2 after which the user can print this sheet. Im
not too worried about the formats or print view stuff, just like to
make this work, I'll appreciate if anyone can help...

I tried the following code but getting errors,

Private Sub CommandButton1_Click()
'
'
Sheets("Sheet1").Select
Range("ActiveCell.Value = Cell_txt_1.Value:ActiveCell.Value =
Cell_txt_2.Value").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True



End Sub


Regards

OK



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Enter Range value and get report



Trevor

Many thanks for the prompt reply, I still cannot manage to get this
code working right. I get erro, and debug points to the following
line...


.Range(Cell_txt_1 & ":" & Cell_txt_2).Copy

The code which I hv entered is as follows;


Private Sub Cell_txt_1_Change()

End Sub

Private Sub Cell_txt_2_Change()

End Sub


Private Sub CommandButton1_Click()

Dim Cell_txt_1 As String
Dim Cell_txt_2 As String


'Cell_txt_1 = "A1" ' for testing ... needs to come from TextBox
'Cell_txt_2 = "m1" ' for testing ... needs to come from TextBox

With Sheets("Sheet1")
.Range(Cell_txt_1 & ":" & Cell_txt_2).Copy
With Sheets("Sheet2")
.Range("A1").PasteSpecial Paste:=xlPasteAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=True
End With
End With


Application.CutCopyMode = False

End Sub


Let me know where im making mistake.

Regards

OK

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Enter Range value and get report

give this a try, just something i threw together quickly. change the form and
sheet names.
i just created a simple form with 2 textboxes and a command button.
the command button calls the macro test in a code module. enter a starting cell
value in textbox1, end cell value in textbox2 and click command button 1.


Sub Test()
Dim ws As Worksheet, ws2 As Worksheet
Dim rng As Range
Dim firstAddress As String, lastAddress As String

Set ws = Worksheets("sheet1")
Set ws2 = Worksheets("sheet2")
ws2.UsedRange.Clear
firstAddress = UserForm1.TextBox1.Value
lastAddress = UserForm1.TextBox2.Value
Set rng = ws.Range(firstAddress & ":" & lastAddress)
rng.Copy _
ws2.Range("A1")

With ws2.PageSetup
.Orientation = xlLandscape
.CenterHorizontally = True
.FooterMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0.35)
.LeftMargin = Application.InchesToPoints(0.35)
.TopMargin = Application.InchesToPoints(0.6)
.BottomMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0)
.PrintArea = ws2.UsedRange.Address
.HeaderMargin = Application.InchesToPoints(0.25)
.RightHeader = "&B&12 " & Date
.RightFooter = ""
.CenterFooter = ""
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ws2.PrintPreview
End Sub


--


Gary


"OK" wrote in message
ups.com...
Hi All,

I hv a excel file with above 203 rows, and 54 columns, It is required
to view these perodically and generate report. I hv tried to make a
userform with two text boxes where user can enter the range row wise
only (e.g A1 and A53), after entering and clicking the command button
the data of this particular row range will be copied and pasted as
transposed in sheet 2 after which the user can print this sheet. Im
not too worried about the formats or print view stuff, just like to
make this work, I'll appreciate if anyone can help...

I tried the following code but getting errors,

Private Sub CommandButton1_Click()
'
'
Sheets("Sheet1").Select
Range("ActiveCell.Value = Cell_txt_1.Value:ActiveCell.Value =
Cell_txt_2.Value").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True



End Sub


Regards

OK



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Enter Range value and get report

Thank you all...

code now working fine for me....

Thanks again....

Regards

Ok

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
Report one value out of a range jollyr Excel Worksheet Functions 2 March 12th 10 01:54 PM
How do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
How do I show the report filter items in a range of cells? JWest Excel Discussion (Misc queries) 0 March 31st 09 04:43 PM
why report manager ignores the range set in the scenario Annm Excel Discussion (Misc queries) 0 September 28th 05 06:43 PM


All times are GMT +1. The time now is 04:59 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"