G
Guest
Hello guys,
I have a worksheet with a small range meant for one user. The goal is to
copy that small range right besides the previous small range, with a changed
username, so each user has it's own small range to work in, all in the same
worksheet. Somehow this doesn't seem to work for me: the following error
keeps popping up: "method Range of object_Global failed". This is my code:
Sub bNaamInstellen_Klikken()
Dim UserName As String
Dim nextColumn As Range
UserName = InputBox(Prompt:="Gelieve de naam van de gebruiker te
typen:", _
Title:="Naam gebruiker wijzigen")
If UserName = "" Then
Exit Sub
Else
Range("bUserName") = UserName
End If
nextColumn = Range("bUserName", 1).End(xlToRight).Column + 1
Range("UserTotal").Copy Cells(nextColumn, 1)
End Sub
In this code i am first asking a username, set the range "bUserName" to the
given username, next i'm trying to copy the range "UserTotal" through the
nextColumn variabele contents to the first empty cell right of the UserTotal
range. I hope i am clear enough on this one... Otherwise feel free to reply
on this one, and i'll try to further clarify.
With regards,
Memento
I have a worksheet with a small range meant for one user. The goal is to
copy that small range right besides the previous small range, with a changed
username, so each user has it's own small range to work in, all in the same
worksheet. Somehow this doesn't seem to work for me: the following error
keeps popping up: "method Range of object_Global failed". This is my code:
Sub bNaamInstellen_Klikken()
Dim UserName As String
Dim nextColumn As Range
UserName = InputBox(Prompt:="Gelieve de naam van de gebruiker te
typen:", _
Title:="Naam gebruiker wijzigen")
If UserName = "" Then
Exit Sub
Else
Range("bUserName") = UserName
End If
nextColumn = Range("bUserName", 1).End(xlToRight).Column + 1
Range("UserTotal").Copy Cells(nextColumn, 1)
End Sub
In this code i am first asking a username, set the range "bUserName" to the
given username, next i'm trying to copy the range "UserTotal" through the
nextColumn variabele contents to the first empty cell right of the UserTotal
range. I hope i am clear enough on this one... Otherwise feel free to reply
on this one, and i'll try to further clarify.
With regards,
Memento