PDA

View Full Version : dividing a number into a given range



apprentice13
01-20-2021, 02:30 PM
hi i want to divide a range to a number here is the photo i dont want to do it with "Function" can u show with Dim or etc. and i want to get the answers as table like 5 units offset to the right or left i tried this

Option Base 1
Sub teilbar() Dim i As Integer, j As Integer Dim x As String
If x Mod 3 = 0
Then teilbar = "Teilbar 3"
Else
teilbar = "Nicht Teilbar"

Cells(i, j + 5) = A(i, j + 5)
End If

Next j
Next i
End Sub
Thanks for helping me

27770

apprentice13
01-20-2021, 02:43 PM
i think im not good with the "arrays" :/

p45cal
01-20-2021, 06:44 PM
I have little idea what you're trying to do.
Sub teilbar()
Dim i As Integer, j As Integer
Dim x, teilba

For j = 1 To 3
For i = 1 To 3
If Cells(i, j).Value Mod 3 = 0 Then teilba = "Teilbar 3" Else teilba = "Nicht Teilbar"
Cells(i, j + 5) = teilba
Next i
Next j
End Sub

apprentice13
01-21-2021, 12:56 AM
Ty very muchh

but i couldn't understant that , wenn should i use "Arrays" dont know exact meanings of arrays or ReDim ?
thanks a lot again

jolivanes
01-23-2021, 02:04 PM
In Deutschland hat mann doch auch Google, oder?
https://excelmacromastery.com/excel-vba-array/


https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/redim-statement
https://bettersolutions.com/vba/arrays/redim-preserve.htm