ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copying ranges etc (https://www.excelbanter.com/excel-programming/283769-copying-ranges-etc.html)

chick-racer[_43_]

copying ranges etc
 

i am having problems getting this to work. i would like to know i
someone can solve this???
thanks alot

I will describe what it's supposed to do:
1. ask user for a Round number
2. matches that up with range of data in sheet 1 to ensure that it'
valid
3. selects a range of 13 cells in the row (on sheet 1) that is besid
the users selected Round number.
4. copies those 13 cells over to sheet 4

here is the code so far:

Sub commandbutton1_click()

Dim rng As Range
Dim roundNumber As Integer
Dim matchNumber As Variant
Dim rowWithNumber As Variant

roundNumber = InputBox("Enter the Round number for which you would lik
the summary ", "Round Number")

Set rng = Worksheets(1).Range("C4:C12")

matchNumber = Application.Match(roundNumber, rng, 0)
If Not IsError(matchNumber) Then

rowWithNumber = rng.Cells(matchNumber).Address(RowAbsolute:=True)

newrng = rng.Cells(matchNumber).Address.Offset(0, 1), Offset(0
12)
newrng.select
selection.copy
worksheets(2).select
range("B5").select
activesheet.paste

Else
MsgBox "That is not a valid Round number"
End If

End Su

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com



All times are GMT +1. The time now is 10:30 PM.

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