Tällainen lukujärjestys (tässä tiedon osoite)
http://personal.inet.fi/koti/kati/lukkari.htm
minulle annettiin ja pitäisi tehdä excelin VB:llä. Minulta loppui taju. Ensin pohdin if lausita ja sitten select case, vaan varmaan for i olisi se oikea tai yksinkertaisin vaihtoehto. Löytyisikö joltain apua asian ratkaisuun, jottei tarttisi näyttää ihan tyhmältä haasteen antajan edessä??
Kiitoksen etukäteen mahdollisille auttajille
Kuinka tällaisen teko onnistuu - auttaisiko joku
3
519
Vastaukset
- vb2005
Sub lasordning()
Dim i As Long, j As Long, veckor As Long
Dim dag As Variant
dag = Date
veckor = 2
For j = 1 To veckor
ActiveSheet.Cells(j * 7 - 6, 1).Value = "tid"
For i = 1 To 7
ActiveSheet.Cells(j * 7 - 6, i 1).Value = dag
dag = dag 1
Next i
Next j
End Sub- vb2005
Sub lasordning()
Dim i As Long, j As Long, veckor As Long
Dim dag As Variant
dag = Date
veckor = 2
For j = 1 To veckor
With ActiveSheet.Cells(j * 7 - 6, 1)
.Value = "tid"
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
End With
For i = 1 To 7
With ActiveSheet.Cells(j * 7 - 6, i 1)
.Value = Format(dag, "ddd d.m.yyyy", vbMonday, vbUseSystem)
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
End With
dag = dag 1
Next i
Next j
For i = xlEdgeLeft To xlInsideHorizontal
With ActiveSheet.Range(Cells(1, 1), Cells(veckor * 7, 8)).Borders(i)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next i
End Sub - vb2005
vb2005 kirjoitti:
Sub lasordning()
Dim i As Long, j As Long, veckor As Long
Dim dag As Variant
dag = Date
veckor = 2
For j = 1 To veckor
With ActiveSheet.Cells(j * 7 - 6, 1)
.Value = "tid"
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
End With
For i = 1 To 7
With ActiveSheet.Cells(j * 7 - 6, i 1)
.Value = Format(dag, "ddd d.m.yyyy", vbMonday, vbUseSystem)
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
End With
dag = dag 1
Next i
Next j
For i = xlEdgeLeft To xlInsideHorizontal
With ActiveSheet.Range(Cells(1, 1), Cells(veckor * 7, 8)).Borders(i)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next i
End SubSub lasordning()
Dim i As Long, j As Long, veckor As Long
Dim veckdag As Integer
Dim dag As Variant
dag = Date
veckdag = DatePart("w", dag, vbMonday, vbUseSystem)
If veckdag > 1 Then
dag = dag 8 - veckdag
End If
veckor = 2
For j = 1 To veckor
With ActiveSheet.Cells(j * 7 - 6, 1)
.Value = "tid"
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
End With
For i = 1 To 7
With ActiveSheet.Cells(j * 7 - 6, i 1)
.Value = Format(dag, "ddd d.m.yyyy", vbMonday, vbUseSystem)
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
End With
dag = dag 1
Next i
Next j
For i = xlEdgeLeft To xlInsideHorizontal
With ActiveSheet.Range(Cells(1, 1), Cells(veckor * 7, 8)).Borders(i)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next i
End Sub
Ketjusta on poistettu 0 sääntöjenvastaista viestiä.
Luetuimmat keskustelut
- 695407
Useita puukotettu Tampereella
Mikäs homma tämä nyt taas on? "Useaa henkilöä on puukotettu Tampereen keskustassa kauppakeskus Ratinan lähistöllä." ht2845353Kuka rääkkää eläimiä Puolangalla?
Poliisi ampui toistakymmentä nälkiintynyttä eläintä Puolangalla Tilalta oli ollut karkuteillä lähes viisikymmentä nälkii964045- 522850
- 222457
- 1192050
Meneeköhän sulla
oikeasti pinnan alla yhtä huonosti kuin mulla? Tai yhtä huonosti mutta jollain eri tyylillä? Ei olisi pitänyt jättää sua472010Lähetä terveisesi kaipaamallesi henkilölle
Vauva-palstalta tuttua kaipaamista uudessa ympäristössä. Kaipuu jatkukoon 💘991737- 721271
PS uusimman gallupin rakettimainen nousija
https://yle.fi/a/74-20170641 Aivan ylivoimaisesti suurin kannatuksen nousu PS:lle. Nousu on alkanut ja jatkuu 2 vuoden1541118