Excel VBA split data to columns

I got a code to split data in first row to next columns:

Option Explicit

Sub SplitEmail()

     Dim rng As Range
     Dim InputRng As Range
     Dim OutRng As Range
     Dim xRow As Integer
     Dim xCol As Integer
     Dim xArr As Variant
     Dim xTitleId As String
     Dim i As Double
     Dim xValue As Variant
     Dim iRow As Double
     Dim iCol As Double
     xTitleId = "Pls enter value"

     xRow = Application.InputBox("Rows :", xTitleId)
     Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)

     xCol = InputRng.Cells.Count / xRow
     ReDim xArr(1 To xRow, 1 To xCol + 1)
     For i = 0 To InputRng.Cells.Count - 1
         xValue = InputRng.Cells(i + 1)
         iRow = i Mod xRow
         iCol = VBA.Int(i / xRow)
         xArr(iRow + 1, iCol + 1) = xValue
     OutRng.Resize(UBound(xArr, 1), UBound(xArr, 2)).Value = xArr
 End Sub

However, I got fail and prompt "runtime error 91 : object variable or With block not set"

Pls help!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib Husain, SyedEngineerCommented:
The code is missing assignment of the inputrng.

Where did you get the code from?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Saqib Husain, SyedEngineerCommented:
Or can you upload a sample data file showing what you want to happen with the data?
hkgalAuthor Commented:
oh yes mate, you prompt me to the solution. Got it and now it works, thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.