• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Macros

i want to use variable range, means user will enter from row as A/B/C then row no. as 1/2/3 then to row as D/E/F and row no. as 4/5/6 then copy it and paste at desired location. Please check my code.
 

Attachments

  • range_test.xlsm
    17.2 KB · Views: 1
Hi Hari,

I made just a bit of changes in your code as below, I am pasting the data on xx sheet.

Code:
Sub CopyActiveSheet()
'add sheet named by input box
'copies active sheet used range to new sheet
Dim Answer$
Dim s As String
Dim e As String

Dim i As Integer
Dim k As Integer
Dim copy_range As String

'Answer = Application.InputBox("Enter new sheet name")

'Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = Answer
copy_range = ""


s = InputBox(" enter start range")
i = InputBox(" starting row")

copy_range = copy_range & s & i & ":"
MsgBox copy_range
e = InputBox(" enter end range")
k = InputBox("enter end row")
copy_range = copy_range & e & k
MsgBox copy_range



Range(copy_range).Copy Sheets("XX").Range("A1")


'Range("a2:b3").Copy

'ActiveSheet.UsedRange.Copy



Application.CutCopyMode = False
End Sub

Regards,
 
Back
Top