Wir wünschen allen Forenteilnehmern ein frohes Fest und einen guten Rutsch ins neue Jahr. x

VBA subroutine
#1
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
Top
#2
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
[-] Folgende(r) 1 Nutzer sagt Danke an Kuwer für diesen Beitrag:
  • oakes
Top


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 3 Gast/Gäste