About adding cell content

muhittinemmi

New Member
Joined
Jun 20, 2023
Messages
19
VBA Code:
Private Sub CommandButton2_Click()
Dim emmi As Long, Say As Byte
emmi = Range("a45").End(3).Row + 1
if cells(emmi,"a").value<>"" then
msgbox "Satır ekleyin. "
exit sub
end if
Cells(emmi, "A") = ComboBox1.List
Cells(emmi, "C") = TextBox1.Text
Cells(emmi, "D") = TextBox2.Text
     Unload Me
End Sub


How can I add the content of H1 instead of a45 in the code.

H1: variable content, such as a46, a47, a48.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
So, are you saying that cell A1 holds the address of the cell you want?
If so, maybe try:
VBA Code:
emmi = Range(Range("H1").Value).End(3).Row + 1
 
Upvote 0
Solution
VBA Code:
Sub Makro3()
'
' Makro3 Makro
'

'
    ActiveSheet.Shapes.Range(Array("Picture 1")).Select
    Selection.Copy
    Range("A1").Select
    ActiveSheet.Paste
    ActiveSheet.Shapes.Range(Array("Picture 9")).Select
    Selection.Copy
    ActiveWindow.SmallScroll Down:=6
    Range("A41").Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=-12
    Range("P1").Select
    ActiveCell.FormulaR1C1 = "ergenekon"
    Range("A2").Select
End Sub


How can I add the content of H2 instead of a41 in the code.

H2: variable content, such as a41, a42, a43.
 
Upvote 0
It should be pretty much the same thing I showed you already, but just with different cell addresses:
Rich (BB code):
    Range(Range("H2").Value).Select
Hopefully, you are starting to see the pattern here.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top