I have a column having working hours of several employees. i have to transfer from the respective employee and write it to a row of the employee name his working hours.
Just use a vlookup to get the value of first employee and then use auto fill range to fill the values for all @vishal.kp
how to transfer the values from the columns to the rows. And after writing 30 columns i want to shift to next row and again write 30 columns.
That is a long process @vishal.kp,
- Assign the range to a string variable as str = “A”
- If you got to know the row count is 30, then change the range in the string variable as str = “D”
This you have to do for multiple columns and many times, if you want it to be dynamic, please let me know
yeah i want it to be dynamic
Then, the string you want to give in the range will be using the if condition inside the code @vishal.kp
Use this code so that you will get the column dynamically as “A” or “AF” or “BG” or whatever it is.
But this is if you have the columns upto 52. Please let me know if you have more columns
For c As Integer = 1 To ExcelSheetRange
Dim str As String = Nothing
If c <= 26 Then
str = Convert.ToChar(64 + c)
ElseIf c > 26 And c <= 52 Then
str = Convert.ToChar(65) + Convert.ToChar(64 + c - 26)
ElseIf c > 52 Then
str = Convert.ToChar(66) + Convert.ToChar(64 + c - 52)
End If
Next