Clever-Excel-Forum

Normale Version: VBA subroutine
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Hi,
I. am new to VBA, I need help with this question on cell referencing and offset

Create a subroutine called  WherePutMe  that asks the user for a row number and column letter then places the 2,2 position of a selection into that cell. (HINT: Make sure that you select a selection before running the sub!)

 Your subroutine will take the 2,2 position of the initial selection (-4 in our example) and place it in cell C7 (specified by the user in the two input boxes):
[
Bild bitte so als Datei hochladen: Klick mich!
]



Sub WherePutMe ()
Dim x As Integer, y As String, z As Double
x = InputBox ("please input the row number:")
y = InputBox ("please input the column letter:")
Range (y & x) = z
ActiveCell.Offset (2, 2) = z

End sub

This is my code but I am not arriving at the right answer, can someone point me to what I am doing wrong? Thanks
Hi,

vielleicht so?
Sub WherePutMe()
Dim x As Integer, y As String, z As Double
x = InputBox("please input the row number:")
y = InputBox("please input the column letter:")
Range(y & x) = z
Range("C7").Select
ActiveCell.Value = z
End Sub
Gruß Uwe